Latest web development tutorials

AngularJS ng-options command

AngularJS Reference Manual AngularJS Reference Manual


AngularJS examples

Use of array elements fill the drop-down list:

<Div ng-app = "myApp " ng-controller = "myCtrl">
<Select ng-model = "selectedName " ng-options = "item for item in names"> </ select>
</ Div>

<Script>
var app = angular.module ( 'myApp', []);
app.controller ( 'myCtrl', function ($ scope) {
$ Scope.names = [ "Emil", "Tobias", "Linus"];
});
</ Script>

try it"

Definition and Usage

ng-options instructions for use <options> filling <select> element option.

ng-options command to use an array to populate the drop-down list, in most cases for use with ng-repeatinstruction.


grammar

<Select ng-options = "array expression"> </ select>

<Details> element supports the instruction.


Parameter Value

value description
array expression Expressions select element array is filled with options.

AngularJS Reference Manual AngularJS Reference Manual