Home » AngularJS ng-options Directive

AngularJS ng-options Directive

by Online Tutorials Library

AngularJS ng-options Directive

The AngularJS ng-options directive is used to dynamically generate a list of <option> elements for the <select> elements. It uses array to fill the dropdown list. The ng-repeat directive can also be used in some cases for the same reason and it is easier too, but ng-options directive provides more flexibility.

It is supported by <select> statement.

Syntax:

array expression: It specifies an expression that selects the specified parts of an array to fill the select element.

Let’s take an example to demonstrate the usage of ng-options directive.

See this example:

Test it Now

You may also like