Improve this Doc View Source ngValue
- directive in module ng
Binds the given expression to the value of <option>
or input[radio]
, so that when the element is selected, the ngModel
of that element is set to the bound value.
ngValue
is useful when dynamically generating lists of radio buttons using ngRepeat
, as shown below.
Likewise, ngValue
can be used to generate <option>
elements for the select
element. In that case however, only strings are supported for the value
attribute, so the resulting ngModel
will always be a string. Support for select
models with non-string values is available via ngOptions
.
Directive Info
- This directive executes at priority level 0.
Usage
- as attribute:
<input [ng-value=""]> ... </input>
Arguments
Param | Type | Details |
---|---|---|
ngValue (optional) | string | angular expression, whose value will be bound to the |
© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://code.angularjs.org/1.3.20/docs/api/ng/directive/ngValue