Skip to content

Commit 583f37d

Browse files
docs(ngChange): clarify when the ngChange expression is evaluated
Closes angular#7866
1 parent 4152155 commit 583f37d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/ng/directive/input.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -2201,9 +2201,15 @@ var ngModelDirective = function() {
22012201
* The expression is evaluated immediately, unlike the JavaScript onchange event
22022202
* which only triggers at the end of a change (usually, when the user leaves the
22032203
* form element or presses the return key).
2204-
* The expression is not evaluated when the value change is coming from the model
2205-
* or when the input does not match the pattern defined for the input in ngPattern.
2206-
*
2204+
*
2205+
* The `ngChange` expression is only evaluated when a change in the input value causes
2206+
* a new value to be committed to the model.
2207+
*
2208+
* It will not be evaluated:
2209+
* * if the value returned from the `$parsers` transformation pipeline has not changed
2210+
* * if the input has continued to be invalid since the model will stay `null`
2211+
* * if the model is changed programmatically and not by a change to the input value
2212+
*
22072213
*
22082214
* Note, this directive requires `ngModel` to be present.
22092215
*

0 commit comments

Comments
 (0)