Bind ng-checked to a scope value

Description

You can bind ng-checked to a scope value.

Example


<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
</head><!--from  ww  w.  ja  v a 2 s. c  o  m-->
<body>
  <div ng-app ng-controller="x">
     <input type="checkbox" ng-checked="y"> {{y}}
  </div>
<script type='text/javascript'>
function x($scope) {
    $scope.y = 1;
}
</script>
</body>
</html>

Click to view the demo





















Home »
  AngularJS »
    AngularJS Example »




Controller
Directives
Expression
Filter
Form
Inject
Scope
Server
Style
Template
Utilities