diff options
Diffstat (limited to 'src/ng/directive/input.js')
| -rw-r--r-- | src/ng/directive/input.js | 15 | 
1 files changed, 11 insertions, 4 deletions
| diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index fbcf3b32..706844eb 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -309,6 +309,8 @@ var inputType = {     * @param {string=} name Property name of the form under which the control is published.     * @param {string=} ngChange Angular expression to be executed when input changes due to user     *    interaction with the input element. +   * @param {string} ngValue Angular expression which sets the value to which the expression should +   *    be set when selected.     *     * @example        <doc:example> @@ -316,21 +318,26 @@ var inputType = {           <script>             function Ctrl($scope) {               $scope.color = 'blue'; +             $scope.specialValue = { +               "id": "12345", +               "value": "green" +             };             }           </script>           <form name="myForm" ng-controller="Ctrl">             <input type="radio" ng-model="color" value="red">  Red <br/> -           <input type="radio" ng-model="color" value="green"> Green <br/> +           <input type="radio" ng-model="color" ng-value="specialValue"> Green <br/>             <input type="radio" ng-model="color" value="blue"> Blue <br/> -           <tt>color = {{color}}</tt><br/> +           <tt>color = {{color | json}}</tt><br/>            </form> +          Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`.          </doc:source>          <doc:scenario>            it('should change state', function() { -            expect(binding('color')).toEqual('blue'); +            expect(binding('color')).toEqual('"blue"');              input('color').select('red'); -            expect(binding('color')).toEqual('red'); +            expect(binding('color')).toEqual('"red"');            });          </doc:scenario>        </doc:example> | 
