For existing AngularJs apps, there are a few things that you can do in order to try and improve performance.
This should help prevent your Angular App from running into memory problems in the browser. There are basically two approaches to this.
In directives that wrap some sort of plugin (e.g. Slick Slider), you need to listen out for the “$destroy” event and call that particular plugin’s cleanup methods. In the case of Slick Slider, it’s the unslick() method, but it could simply be a call to jQuery’s remove() method, or you could just set the value of the html element to an empty string:
Unbind any watches when the current scope is destroyed
When you create a watch on a scoped variable, or on an event in angular, the $watch function returns a function that when called, will remove the watch. Call…
View original post 451 more words