File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -309,28 +309,35 @@ var inputType = {
309
309
* @param {string= } name Property name of the form under which the control is published.
310
310
* @param {string= } ngChange Angular expression to be executed when input changes due to user
311
311
* interaction with the input element.
312
+ * @param {string } ngValue Angular expression which sets the value to which the expression should
313
+ * be set when selected.
312
314
*
313
315
* @example
314
316
<doc:example>
315
317
<doc:source>
316
318
<script>
317
319
function Ctrl($scope) {
318
320
$scope.color = 'blue';
321
+ $scope.specialValue = {
322
+ "id": "12345",
323
+ "value": "green"
324
+ };
319
325
}
320
326
</script>
321
327
<form name="myForm" ng-controller="Ctrl">
322
328
<input type="radio" ng-model="color" value="red"> Red <br/>
323
- <input type="radio" ng-model="color" value="green "> Green <br/>
329
+ <input type="radio" ng-model="color" ng- value="specialValue "> Green <br/>
324
330
<input type="radio" ng-model="color" value="blue"> Blue <br/>
325
- <tt>color = {{color}}</tt><br/>
331
+ <tt>color = {{color | json }}</tt><br/>
326
332
</form>
333
+ Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`.
327
334
</doc:source>
328
335
<doc:scenario>
329
336
it('should change state', function() {
330
- expect(binding('color')).toEqual('blue');
337
+ expect(binding('color')).toEqual('" blue" ');
331
338
332
339
input('color').select('red');
333
- expect(binding('color')).toEqual('red');
340
+ expect(binding('color')).toEqual('" red" ');
334
341
});
335
342
</doc:scenario>
336
343
</doc:example>
You can’t perform that action at this time.
0 commit comments