Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Aside leaks memory by not destroying its own scope when closed #1715

Closed
jmtsi opened this issue Jun 2, 2015 · 6 comments
Closed

Aside leaks memory by not destroying its own scope when closed #1715

jmtsi opened this issue Jun 2, 2015 · 6 comments

Comments

@jmtsi
Copy link

jmtsi commented Jun 2, 2015

I use the current version of angular-strap (2.2.2) with angular 1.3.15 and noticed that the aside's scope never gets destroyed when using data-template.
This can be reproduced by using the default template with a controller that only has the listener for $destroy-event -> It never gets fired.

@vmlf01
Copy link
Collaborator

vmlf01 commented Jun 7, 2015

Not sure what is your exact setup. I have created a plunker with an example following your description and the destroy is triggered when the aside DOM element is destroyed, as expected.
http://plnkr.co/edit/0sOUcGNVky6uUhdX4z1v?p=preview

@jmtsi
Copy link
Author

jmtsi commented Jun 8, 2015

In your example the $destroy-event doesn't get triggered when I close the aside, so if I open & close it multiple times, I have several instances of the controller in memory. If I click the destroy-button to manually trigger the $destroy-event, I get multiple alerts from those controllers.

I can of course force the destroy by replacing the close-button's ng-click="$hide()" with ng-click="$hide(); $destroy();".

So is this expected behavior? It surprised me, at least :)

@vmlf01
Copy link
Collaborator

vmlf01 commented Jun 8, 2015

Ah, I see what you mean now, I didn't test the plunker enough.
The same thing happened with tooltip, but aside/modal is not based on tooltip, so this needs to have a similar fix applied to prevent the memory leak. Will try to come up with a PR in the next few days.
Thanks for the follow up.

@lookfirst
Copy link
Contributor

@vmlf01 close this?

@vmlf01
Copy link
Collaborator

vmlf01 commented Jun 21, 2015

thanks.

@lock
Copy link

lock bot commented Jan 26, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the outdated label Jan 26, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants