There have been a lot of problems with the recent use of the Select command in angular, which is depressing. After looking at a lot of data, it was not easy to find the Select command, and decided to summarize.
Select usage:
<select
ng-model= "
[name="]
[required= "]
[ng-required="]
[ng-options=
"]]> </select>
Attribute Description:
Discovery and no Ng-change attribute
Ng-required: When the property value is true, add required validation to select, False when not validated.
Ng-options: Specifies the data source to generate option options.
When a data source is an array, use:
Label for value in array
Select as label for value in array
Label GROUP by Group for value in array
Select as Label group by GROUPEXPR for value in array track by trackexpr
When the data source is an object, use:
Label for (key,value) in Object
Select as label for (Key,value) in Object
Label GROUP BY Group for (Key,value) in Object
Select as Label group by GROUPEXPR for (Key,value) into object track by trackexpr
Specific Description:
Array/object: Array/Object
The name displayed by the Label:option option.
Select: Is the value that is bound to Ngmodel after an item is selected.
Value: The values in the array.
(key,value): Key,value of objects.
GROUP BY groupexpr: for option grouping,
The difference between ng-options and ng-repeat automatically generates option options:
When the Ng-options option is selected, the value bound to Ngmodel can be an object. Ng-repeat bound to Ngmodel value can only be a string.
Note: You need to specify a value for Ngmodel when the select is initialized, otherwise a blank option appears.
The above is a small set of angular to introduce the select instructions in the use of detailed, hope to help everyone, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!