AngularJS ng-checked directive
AngularJS instance
Select one or select all options:
<!DOCTYPE html><html><head><meta charset="utf-8"><script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script></head><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">Ford<br> <input type="checkbox" ng-checked="all">Mercedes <p>Click "Check all" to select all cars. </p></body></html>
Definition and usage
The ng-checked directive is used to set the checked properties of a checkbox or radio button.
If the ng-checked property returns true, the checkbox or radio button will be selected.
grammar
<input type="checkbox|radio" ng-checked="expression"></input>
type is supported by the <input> element of checkbox or radio.
Parameter value
| value | describe |
|---|---|
| Expression | If true is returned, the element option will be selected. |
The above is the information compilation of the AngularJS ng-checked instruction. We will continue to add it later. Thank you for your support!