ngValue (directive)
Improve this Doc View Source ngValue
- directive in module ng
Binds the given expression to the value of the element.
It is mainly used on input[radio]
and option elements, so that when the element is selected, the ngModel
of that element (or its select
parent element) is set to the bound value. It is especially useful for dynamically generated lists using ngRepeat
, as shown below.
It can also be used to achieve one-way binding of a given expression to an input element such as an input[text]
or a textarea
, when that element does not use ngModel.
Directive Info
- This directive executes at priority level 0.
Usage
- as element: (This directive can be used as custom element, but be aware of IE restrictions).
<ng-value [ng-value="string"]> ... </ng-value>
- as attribute:
<input [ng-value="string"]> ... </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.6.4/docs/api/ng/directive/ngValue