Angularjs Examples

AJS Examples


AngularJS ng-Checked Directive

The AngularjS ng-checked directive is used to set checkbox checked.

Syntax

<p ng-checked="value"></p> 

AngularJS ng-Checked Directive Example

<html>
<head>
<title>My first AngularJS checked Directive code</title>
<script SRC="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js">
</script>
<script>
//Defining Controller Using Standard Javascrip Object Constructor
function CustomerController($scope) {
$scope.checked = false;
}
</script>
</head>
<body>
<div ng-app="">
<div ng-controller="CustomerController"> 

Check Me: <input type="checkbox" ng-model="checked"><br/>
This Will Check Automatically: <input id="checkSlave" type="checkbox" ng-checked="checked">

</div>
</div>
</body>
</html>
See Live Example