English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="https://cdn.staticfile.org/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">Mercedes <p>Click "Check all" to select all cars.</p> </body> </html>Test and see ‹/›
ng-checked The directive is used to set the checked attribute of checkboxes (checkboxes) or radio buttons (radio buttons).
If ng-checked If the attribute returns true, the checkbox (checkbox) or radio button (radio) will be selected.
<input type="checkbox|radio" ng-checked="expression"></input>
Input elements of type checkbox or radio support the type attribute.
Value | Description |
---|---|
expression | If the expression returns true, the element option will be selected. |