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

fix(ngMessages): create new scope for ngMessage, clean it up correctly #14308

Merged
merged 1 commit into from
Jun 10, 2016

Conversation

Narretz
Copy link
Contributor

@Narretz Narretz commented Mar 23, 2016

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)
#14307

What is the new behavior (if this is a feature change)?
ngMessage creates a child scope instead of reusing the ngMessages scope.

Does this PR introduce a breaking change?
Possibly. Needs investigation.

Please check if the PR fulfills these requirements

Other information:

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

@@ -1,6 +1,6 @@
'use strict';

describe('ngMessages', function() {
fdescribe('ngMessages', function() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops

@Narretz Narretz force-pushed the fix-messages-leak branch 2 times, most recently from 7a2c1ef to 23d6bde Compare March 24, 2016 10:40
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 Narretz force-pushed the fix-messages-leak branch from 23d6bde to cbc81b9 Compare June 10, 2016 12:26
@Narretz Narretz merged commit 3360b44 into angular:master Jun 10, 2016
Narretz added a commit that referenced this pull request 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ngMessages with bound message doesn't remove watch when message is removed
3 participants