AngularJS ng-checked
Directive
AngularJS Example
Select one or select all options:
<body ng-app=""><p>My:</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</body>
Definition and Usage
The ng-checked directive is used to set the checked attribute of a checkbox or radio button.
If the ng-checked attribute returns true, the checkbox or radio button will be selected.
Syntax
Supported on <input> elements with type checkbox or radio.
Parameter Values
Value | Description |
---|---|
expression | If it returns true, the element option will be selected. |