diff options
| author | Vojta Jina | 2012-03-30 12:07:19 -0700 | 
|---|---|---|
| committer | Vojta Jina | 2012-04-03 10:10:44 -0700 | 
| commit | 06d0955074f79de553cc34fbf945045dc458e064 (patch) | |
| tree | 131c952906c145bcd9c6e39721d42e2bce82cee5 /docs | |
| parent | a22e0699bef61a7083b0b628fb6043531c0ca1c0 (diff) | |
| download | angular.js-06d0955074f79de553cc34fbf945045dc458e064.tar.bz2 | |
feat(ngModel): update model on each key stroke (revert ngModelInstant)
It turns out that listening only on "blur" event is not sufficient in many scenarios,
especially when you use form validation you always had to use ngModelnstant
e.g. if you want to disable a button based on valid/invalid form.
The feedback we got from our apps as well as external apps is that the
ngModelInstant should be the default.
In the future we might provide alternative ways of suppressing updates
on each key stroke, but it's not going to be the default behavior.
Apps already using the ngModelInstant can safely remove it from their
templates. Input fields without ngModelInstant directive will start propagating
the input changes into the model on each key stroke.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/content/guide/dev_guide.forms.ngdoc | 12 | 
1 files changed, 4 insertions, 8 deletions
diff --git a/docs/content/guide/dev_guide.forms.ngdoc b/docs/content/guide/dev_guide.forms.ngdoc index c643a613..0c3a7fc3 100644 --- a/docs/content/guide/dev_guide.forms.ngdoc +++ b/docs/content/guide/dev_guide.forms.ngdoc @@ -20,7 +20,7 @@ In addition it provides {@link api/angular.module.ng.$compileProvider.directive.  <doc:source>  <div ng-controller="Controller">    <form novalidate class="simple-form"> -    Name: <input type="text" ng-model="user.name" ng-model-instant /><br /> +    Name: <input type="text" ng-model="user.name" /><br />      E-mail: <input type="email" ng-model="user.email" /><br />      Gender: <input type="radio" ng-model="user.gender" value="male" />male      <input type="radio" ng-model="user.gender" value="female" />female<br /> @@ -50,11 +50,7 @@ In addition it provides {@link api/angular.module.ng.$compileProvider.directive.  </doc:example> -Note that: - -  * the {@link api/angular.module.ng.$compileProvider.directive.ng-model-instant ng-model-instant} causes the `user.name` to be updated immediately. - -  * `novalidate` is used to disable browser's native form validation. +Note that `novalidate` is used to disable browser's native form validation. @@ -76,7 +72,7 @@ This ensures that the user is not distracted with an error until after interacti  <div ng-controller="Controller">    <form novalidate class="css-form">      Name: -      <input type="text" ng-model="user.name" ng-model-instant required /><br /> +      <input type="text" ng-model="user.name" required /><br />      E-mail: <input type="email" ng-model="user.email" required /><br />      Gender: <input type="radio" ng-model="user.gender" value="male" />male      <input type="radio" ng-model="user.gender" value="female" />female<br /> @@ -147,7 +143,7 @@ This allows us to extend the above example with these features:      <input type="checkbox" ng-model="user.agree" name="userAgree" required />      I agree: <input ng-show="user.agree" type="text" ng-model="user.agreeSign" -              ng-model-instant required /><br /> +              required /><br />      <div ng-show="!user.agree || !user.agreeSign">Please agree and sign.</div>      <button ng-click="reset()" disabled="{{isUnchanged(user)}}">RESET</button>  | 
