This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
ngMessages with bound message doesn't remove watch when message is removed #14307
Comments
That's quite a leak there ... not sure if there's an easy way to fix it. Does your message text change while it is displayed? If not, as a workround you could use one-time bindings, so no watcher is added at all. |
Yes, we have some messages which need to update while they're displayed - others already use one-time bindings where we can. |
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Mar 23, 2016
Previously, ngMessage elements used the same scope as ngMessages. When ngMessage has interpolation in the textContent, then removing the message would not remove the watcher from the scope - it would only be removed when the whole ngMessages element was removed. This commit changes the ngMessage transclude function to create a new child scope instead, which can be destroyed safely when the message element is removed and the message is detached Fixes angular#14307
2 tasks
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Mar 24, 2016
Previously, ngMessage elements used the same scope as ngMessages. When ngMessage has interpolation in the textContent, then removing the message would not remove the watcher from the scope - it would only be removed when the whole ngMessages element was removed. This commit changes the ngMessage transclude function to create a new child scope instead, which can be destroyed safely when the message element is removed and the message is detached Fixes angular#14307
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Jun 10, 2016
Previously, ngMessage elements used the same scope as ngMessages. When ngMessage has interpolation in the textContent, then removing the message would not remove the watcher from the scope - it would only be removed when the whole ngMessages element was removed. This commit changes the ngMessage transclude function to create a new child scope instead, which can be destroyed safely when the message element is removed and the message is detached Fixes angular#14307
Narretz
added a commit
that referenced
this issue
Jun 10, 2016
Previously, ngMessage elements used the same scope as ngMessages. When ngMessage has interpolation in the textContent, then removing the message would not remove the watcher from the scope - it would only be removed when the whole ngMessages element was removed. This commit changes the ngMessage transclude function to create a new child scope instead, which can be destroyed safely when the message element is removed and the message is detached Fixes #14307 PR (#14308)
Narretz
added a commit
that referenced
this issue
Jun 10, 2016
Previously, ngMessage elements used the same scope as ngMessages. When ngMessage has interpolation in the textContent, then removing the message would not remove the watcher from the scope - it would only be removed when the whole ngMessages element was removed. This commit changes the ngMessage transclude function to create a new child scope instead, which can be destroyed safely when the message element is removed and the message is detached Fixes #14307 PR (#14308)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
We have ngMessage texts which can change, and so are bound to model values rather than being hardcoded into the view.
eg.
Every time the message is shown, it adds a new watch which is not removed when the message is removed, but stays added until the parent ng-messages element is destroyed.
JSFiddle showing the problem is available here https://jsfiddle.net/jwalkersl/Lumjd9tm/
The text was updated successfully, but these errors were encountered: