Joined March 2014
·

Chowdhury M Rahman

Bangladesh
·
·

Posted to Speeding up AngularJS's $digest loop over 1 year ago

Thank you for the nice article.

As for using $rootScope.$on issue with $destroy > here is a trick that I found on ng site that I use >
</br>
$provide.decorator('$rootScope', ['$delegate', function($delegate) { </br> $delegate.constructor.prototype.$onRootScope = function(name, listener){ </br> var unsubscribe = $delegate.$on(name, listener); </br> this.$on('$destroy', unsubscribe); </br> }; </br> return $delegate; </br> }]);</code> </br>

This takes care of the zombie listeners on $destroy. I don't have the direct link to this issue, handy at the moment, but you should be able to find it on Angular's github site.

Thanks once again for the excellent article. Will surely refer back to this when I hit the perf wall in future. :-)

Achievements
1 Karma
0 Total ProTip Views