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=""> Click the checkbox to select the BMW option: <input type="checkbox" ng-model="mySel"> <p>I like the car: </p> <select> <option>Volvo</option> The selected attribute of the <option> element.-selected="mySel">BMW</option> <option>Ford</option> </select> </body> </html>Test and see ‹/›
ng-selected This directive is used to set the options in the <select> list. The selected attribute of the <option> element.
ng-selected
The expression of the attribute returns true, then the option is selected.
The selected attribute of the <option> element.-selected="expression"></option>
The <option> element supports this directive.
Value | Description |
---|---|
expression | The option is selected if the expression is true |