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>Mes véhicules :</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>Cliquez sur "Check all" pour sélectionner tous les véhicules.</p> </body> </html>Voyons voir ‹/›
ng-checked L'instruction est utilisée pour définir l'attribut checked de la case à cocher (checkbox) ou du bouton radio (radio).
Si ng-checked L'attribut retourne true, la case à cocher (checkbox) ou le bouton radio (radio) sera sélectionné.
<input type="checkbox|radio" ng-checked="expression"></input>
Les éléments <input> de type checkbox ou radio prennent en charge ce type.
Valeur | Description |
---|---|
expression | Si le retour est true, l'élément option sera sélectionné. |