Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit d6f7dc8

Browse files
jubobagkalpak
authored andcommitted
docs(ngModel): fix example
For the example to work correctly, the initial model values have to be empty strings. Closes #15272
1 parent 525ed11 commit d6f7dc8

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/ng/directive/ngModel.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
469469
* angular.module('cancel-update-example', [])
470470
*
471471
* .controller('CancelUpdateController', ['$scope', function($scope) {
472-
* $scope.model = {};
472+
* $scope.model = {value1: '', value2: ''};
473473
*
474474
* $scope.setEmpty = function(e, value, rollback) {
475475
* if (e.keyCode === 27) {
@@ -484,8 +484,8 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
484484
* </file>
485485
* <file name="index.html">
486486
* <div ng-controller="CancelUpdateController">
487-
* <p>Both of these inputs are only updated if they are blurred. Hitting escape should
488-
* empty them. Follow these steps and observe the difference:</p>
487+
* <p>Both of these inputs are only updated if they are blurred. Hitting escape should
488+
* empty them. Follow these steps and observe the difference:</p>
489489
* <ol>
490490
* <li>Type something in the input. You will see that the model is not yet updated</li>
491491
* <li>Press the Escape key.
@@ -502,17 +502,17 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
502502
*
503503
* <form name="myForm" ng-model-options="{ updateOn: 'blur' }">
504504
* <div>
505-
* <p id="inputDescription1">Without $rollbackViewValue():</p>
506-
* <input name="value1" aria-describedby="inputDescription1" ng-model="model.value1"
507-
* ng-keydown="setEmpty($event, 'value1')">
508-
* value1: "{{ model.value1 }}"
505+
* <p id="inputDescription1">Without $rollbackViewValue():</p>
506+
* <input name="value1" aria-describedby="inputDescription1" ng-model="model.value1"
507+
* ng-keydown="setEmpty($event, 'value1')">
508+
* value1: "{{ model.value1 }}"
509509
* </div>
510510
*
511511
* <div>
512-
* <p id="inputDescription2">With $rollbackViewValue():</p>
513-
* <input name="value2" aria-describedby="inputDescription2" ng-model="model.value2"
514-
* ng-keydown="setEmpty($event, 'value2', true)">
515-
* value2: "{{ model.value2 }}"
512+
* <p id="inputDescription2">With $rollbackViewValue():</p>
513+
* <input name="value2" aria-describedby="inputDescription2" ng-model="model.value2"
514+
* ng-keydown="setEmpty($event, 'value2', true)">
515+
* value2: "{{ model.value2 }}"
516516
* </div>
517517
* </form>
518518
* </div>

0 commit comments

Comments
 (0)