You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
SCOPE DESTRUCTION: Directive scope is never destroyed if immediately switched out and it has templateUrl. #9197
We have a directive which uses templateUrl that is rendered within a ngSwitch. There is a scenario where on page load the directive is rendered, but then immediately some conditions change causing ngSwitch to remove the directive from page. I found that in that case the directive's scope never gets destroyed.
In the demo open browser's JS console. Notice that you will only see '>>>Created' message, but no '>>>Destroyed'. This bug happens only when the directive uses templateUrl. If you change the above demo code to use template instead then notice the bug is gone.
changed the title [-]Directive scope is never destroyed if immediately switched out and it has templateUrl.[/-][+]SCOPE DESTRUCTION: Directive scope is never destroyed if immediately switched out and it has templateUrl.[/+]on Sep 26, 2014
Activity
lgalfaso commentedon Sep 21, 2014
The issue is that the scope that the directive gets is already destroyed, in fact, it is already removed from the hierarchy
lgalfaso commentedon Sep 21, 2014
Let me take a deeper look into this issue
lgalfaso commentedon Sep 21, 2014
it looks like this is a bigger issue than expected
caitp commentedon Sep 24, 2014
@petebacondarwin assigning this to you since it's basically the same as lucas' dupe (lets just close it when we land the fix)
[-]Directive scope is never destroyed if immediately switched out and it has templateUrl.[/-][+]SCOPE DESTRUCTION: Directive scope is never destroyed if immediately switched out and it has templateUrl.[/+]fix($compile): Resolve leak with asynchronous compilation
fix($compile): Resolve leak with asynchronous compilation
tiff commentedon Oct 5, 2014
The Changelog says that this also made it into v1.2.26. I just downloaded it from angularjs.org and didn't find this change in it...
Edit: Probably because of this commit
cztomsik commentedon Oct 21, 2014
+1