EVOLUTION-MANAGER
Edit File: ngValue.html
<a href='https://github.com/angular/angular.js/edit/v1.3.x/src/ng/directive/input.js?message=docs(ngValue)%3A%20describe%20your%20change...#L1526' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit"> </i>Improve this Doc</a> <a href='https://github.com/angular/angular.js/tree/v1.3.9/src/ng/directive/input.js#L1526' class='view-source pull-right btn btn-primary'> <i class="glyphicon glyphicon-zoom-in"> </i>View Source </a> <header class="api-profile-header"> <h1 class="api-profile-header-heading">ngValue</h1> <ol class="api-profile-header-structure naked-list step-list"> <li> - directive in module <a href="api/ng">ng</a> </li> </ol> </header> <div class="api-profile-description"> <p>Binds the given expression to the value of <code><option></code> or <a href="api/ng/input/input[radio]"><code>input[radio]</code></a>, so that when the element is selected, the <a href="api/ng/directive/ngModel"><code>ngModel</code></a> of that element is set to the bound value.</p> <p><code>ngValue</code> is useful when dynamically generating lists of radio buttons using <a href="api/ng/directive/ngRepeat"><code>ngRepeat</code></a>, as shown below.</p> <p>Likewise, <code>ngValue</code> can be used to generate <code><option></code> elements for the <a href="api/ng/directive/select"><code>select</code></a> element. In that case however, only strings are supported for the <code>value</code>attribute, so the resulting <code>ngModel</code> will always be a string. Support for <code>select</code> models with non-string values is available via <code>ngOptions</code>.</p> </div> <div> <h2>Directive Info</h2> <ul> <li>This directive executes at priority level 0.</li> </ul> <h2 id="usage">Usage</h2> <div class="usage"> <ul> <li>as attribute: <pre><code><input [ng-value=""]> ... </input></code></pre> </li> </div> <section class="api-section"> <h3>Arguments</h3> <table class="variables-matrix input-arguments"> <thead> <tr> <th>Param</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td> ngValue <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>angular expression, whose value will be bound to the <code>value</code> attribute of the <code>input</code> element</p> </td> </tr> </tbody> </table> </section> <h2 id="example">Example</h2><p> <div> <a ng-click="openPlunkr('examples/example-ngValue-directive')" class="btn pull-right"> <i class="glyphicon glyphicon-edit"> </i> Edit in Plunker</a> <div class="runnable-example" path="examples/example-ngValue-directive" name="ngValue-directive" module="valueExample"> <div class="runnable-example-file" name="index.html" language="html" type="html"> <pre><code><script> angular.module('valueExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.names = ['pizza', 'unicorns', 'robots']; $scope.my = { favorite: 'unicorns' }; }]); </script> <form ng-controller="ExampleController"> <h2>Which is your favorite?</h2> <label ng-repeat="name in names" for="{{name}}"> {{name}} <input type="radio" ng-model="my.favorite" ng-value="name" id="{{name}}" name="favorite"> </label> <div>You chose {{my.favorite}}</div> </form></code></pre> </div> <div class="runnable-example-file" name="protractor.js" type="protractor" language="js"> <pre><code>var favorite = element(by.binding('my.favorite')); it('should initialize to model', function() { expect(favorite.getText()).toContain('unicorns'); }); it('should bind the values to the inputs', function() { element.all(by.model('my.favorite')).get(0).click(); expect(favorite.getText()).toContain('pizza'); });</code></pre> </div> <iframe class="runnable-example-frame" src="examples/example-ngValue-directive/index.html" name="example-ngValue-directive"></iframe> </div> </div> </p> </div>