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

fix(ngModel): do not throw if view value changes on destroyed scope #16585

Closed
wants to merge 1 commit into from

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented May 30, 2018

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug fix.

What is the current behavior? (You can also link to an open issue here)
If the scope associted with an NgModelController instance is destroyed between the view value changing and actually calling $$debounceViewValueCommit(), an error is throwing when we try to check this.$$scope.$root.$$phase (since $root has been set to null as part of $destroy()).

This could, for example, happen if updating the value is debounced either by asynchronously calling $setViewValue() or via ngModelOptions.

See also #16583.

What is the new behavior (if this is a feature change)?
No error \o/

Does this PR introduce a breaking change?
No.

Please check if the PR fulfills these requirements

Other information:
Fixes #16583.

This could for example happen if updating the value is debounced (either
by asynchronously calling `$setViewValue()` or via `ngModelOptions`).

Fixes angular#16583
gkalpak added a commit that referenced this pull request May 31, 2018
This could for example happen if updating the value is debounced (either
by asynchronously calling `$setViewValue()` or via `ngModelOptions`).

Fixes #16583

Closes #16585
@gkalpak gkalpak closed this in 459997b May 31, 2018
@gkalpak gkalpak deleted the fix-ngModel-destroyed-scope branch May 31, 2018 11:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

intermitten bug: cannot read property '$$phase' of null
3 participants