select (directive in module ng )

Improve this doc

Description

HTML SELECT element with angular data-binding.

ngOptions

Optionally ngOptions attribute can be used to dynamically generate a list of <option> elements for a <select> element using an array or an object obtained by evaluating the ngOptions expression. ˝˝ When an item in the select menu is select, the value of array element or object property represented by the selected option will be bound to the model identified by the ngModel directive of the parent select element.

Optionally, a single hard-coded <option> element, with the value set to an empty string, can be nested into the <select> element. This element will then represent null or "not selected" option. See example below for demonstration.

Note: ngOptions provides iterator facility for <option> element which should be used instead of ngRepeat when you want the select model to be bound to a non-string value. This is because an option element can currently be bound to string values only.

Usage

This directive can be used as custom element, but be aware of IE restrictions.as element:
<select
       ngModel="{string}"
       [name="{string}"]
       [required]
       [ngRequired="{string}"]
       [ngOptions="{comprehension_expression}"]>
</select>

Parameters

Example

Source







Demo