AngularJS ng-checked Directive


Check one to check them all:

<body ng-app="">
<p>My cars:</p>
<input type="checkbox" ng-model="all"> Check all<br><br>

<input type="checkbox" ng-checked="all">Volvo<br>
<input type="checkbox" ng-checked="all">Ford<br>
<input type="checkbox" ng-checked="all">Mercedes
Try it yourself »

Definition and Usage

The ng-checked order sets the checked property of a checkbox or a radiobutton.

The checkbox, or radiobutton, will be checked if the articulation inside the ng-checked quality returns true.

The ng-checked order is important to most likely move the esteem between true and false. In HTML, you can't set the checked ascribe to false (the nearness of the checked quality makes the component checked, paying little mind to it's value).


<input type="checkbox|radio" ng-checked="expression"></input>

Supported by <input> components of sort checkbox or radio.

Parameter Values

Value Description
expression An articulation that will set the component's checked trait in the event that it returns true.