My understanding is that any listeners are removed if a scope is destroyed.
So if you do
$rootScope.$on('...')
you should better remove the listener yourself, because the $rootScope
won't ever get destroyed
For example
yourModule.controller("someController", function($scope) {
var removeListenerFn = $rootScope.$on('translation-changed',
handleTranslationChanged);
$scope.$on("$destroy", removeListenerFn);
Sander, please correct me if I'm wrong.
On Tuesday, July 8, 2014 8:11:22 AM UTC+2, Sander Elias wrote:
>
> Hi Joberto,
>
> Normally AngularJS takes care of it. It is actually quite good at managing
> memory, and there are very few leaks there. And the ones that are still
> there
> are due to browser bugs, and are being worked on (by nudging the browsers
> vendor, and/or creating workarounds)
>
> Most of those issues arise from hiding DOM elements, and never reuse them,
> or caching functions, that are happily keeping stale info.
> (among the other stuff you can do in JS to leak memory)
>
> Regards
> Sander
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.