From 583f37df5e9c2a31af5bcc7eafb6ac315be35dae Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Sat, 26 Jul 2014 10:58:25 +0100 Subject: [PATCH] docs(ngChange): clarify when the ngChange expression is evaluated Closes #7866 --- src/ng/directive/input.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index 6c10c059..0c37eaf4 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -2201,9 +2201,15 @@ var ngModelDirective = function() { * The expression is evaluated immediately, unlike the JavaScript onchange event * which only triggers at the end of a change (usually, when the user leaves the * form element or presses the return key). - * The expression is not evaluated when the value change is coming from the model - * or when the input does not match the pattern defined for the input in ngPattern. - * + * + * The `ngChange` expression is only evaluated when a change in the input value causes + * a new value to be committed to the model. + * + * It will not be evaluated: + * * if the value returned from the `$parsers` transformation pipeline has not changed + * * if the input has continued to be invalid since the model will stay `null` + * * if the model is changed programmatically and not by a change to the input value + * * * Note, this directive requires `ngModel` to be present. *