AngularJS Tutorial - ng-checked








We can use ng-checked to mark an input check box checked.

Example

The following code shows how to ng-checked.


<!-- www.ja v  a2s .c  o m-->

<!doctype html>
<html ng-app="myApp">
<head>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.3/angular.js"></script>
</head>
<body>

  <label>isOK = {{isOK}}</label>
  <input type="checkbox"
         ng-checked="isOK"
         ng-init="isOK = true"
         ng-model="isOK">

  <script>
    angular.module('myApp', [])
  </script>

</body>
</html>

The code above is rendered as follows: