docs(ngModel): fix example
For the example to work correctly, the initial model values have to be empty strings. Closes #15272
This commit is contained in:
committed by
Georgios Kalpakas
parent
fcf182eb13
commit
5419201a3c
+11
-11
@@ -451,7 +451,7 @@ NgModelController.prototype = {
|
||||
* angular.module('cancel-update-example', [])
|
||||
*
|
||||
* .controller('CancelUpdateController', ['$scope', function($scope) {
|
||||
* $scope.model = {};
|
||||
* $scope.model = {value1: '', value2: ''};
|
||||
*
|
||||
* $scope.setEmpty = function(e, value, rollback) {
|
||||
* if (e.keyCode === 27) {
|
||||
@@ -466,8 +466,8 @@ NgModelController.prototype = {
|
||||
* </file>
|
||||
* <file name="index.html">
|
||||
* <div ng-controller="CancelUpdateController">
|
||||
* <p>Both of these inputs are only updated if they are blurred. Hitting escape should
|
||||
* empty them. Follow these steps and observe the difference:</p>
|
||||
* <p>Both of these inputs are only updated if they are blurred. Hitting escape should
|
||||
* empty them. Follow these steps and observe the difference:</p>
|
||||
* <ol>
|
||||
* <li>Type something in the input. You will see that the model is not yet updated</li>
|
||||
* <li>Press the Escape key.
|
||||
@@ -484,17 +484,17 @@ NgModelController.prototype = {
|
||||
*
|
||||
* <form name="myForm" ng-model-options="{ updateOn: 'blur' }">
|
||||
* <div>
|
||||
* <p id="inputDescription1">Without $rollbackViewValue():</p>
|
||||
* <input name="value1" aria-describedby="inputDescription1" ng-model="model.value1"
|
||||
* ng-keydown="setEmpty($event, 'value1')">
|
||||
* value1: "{{ model.value1 }}"
|
||||
* <p id="inputDescription1">Without $rollbackViewValue():</p>
|
||||
* <input name="value1" aria-describedby="inputDescription1" ng-model="model.value1"
|
||||
* ng-keydown="setEmpty($event, 'value1')">
|
||||
* value1: "{{ model.value1 }}"
|
||||
* </div>
|
||||
*
|
||||
* <div>
|
||||
* <p id="inputDescription2">With $rollbackViewValue():</p>
|
||||
* <input name="value2" aria-describedby="inputDescription2" ng-model="model.value2"
|
||||
* ng-keydown="setEmpty($event, 'value2', true)">
|
||||
* value2: "{{ model.value2 }}"
|
||||
* <p id="inputDescription2">With $rollbackViewValue():</p>
|
||||
* <input name="value2" aria-describedby="inputDescription2" ng-model="model.value2"
|
||||
* ng-keydown="setEmpty($event, 'value2', true)">
|
||||
* value2: "{{ model.value2 }}"
|
||||
* </div>
|
||||
* </form>
|
||||
* </div>
|
||||
|
||||
Reference in New Issue
Block a user