From 8dd4f14a04afdf1cc1d1ab8448a0ec533799dfaf Mon Sep 17 00:00:00 2001 From: Abdessamad Idrissi Date: Tue, 7 Jan 2014 00:47:41 +0100 Subject: docs(input): document ngValue directive Extend the example with ng-value showing how to deal with default checked radio boxes. Closes #5654 --- src/ng/directive/input.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/ng/directive/input.js') 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 @@ -316,21 +318,26 @@ var inputType = {
Red
- Green
+ Green
Blue
- color = {{color}}
+ color = {{color | json}}
+ Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`. 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"'); });
-- cgit v1.2.3