ngOptions is a directive that simplifies the creation of a html dropdown box for the selection of an item from an array that will be stored in a model. The ngOptions attribute is used to dynamically generate a list of < option > elements for the < select > element using the array or object obtained by evaluating the ngOptions comprehension expression.
With ng-options the markup can be reduced to just a select tag and the directive will create the same select:
There is anther way of creating SELECT options using ng-repeat, but it is not recommended to use ng-repeat as it is mostly used for general purpose like, the forEach just to loop. Whereas ng-options is specifically for creating SELECT tag options.
Above example using ng-repeat would be
Lets see the above example in detail also with some variations in it.
Data model for the example:
Option tag generated on selection:
f.label will be the label of the < option > and the value will contain the entire object.