The content of this article is about a brief discussion of the usage of $destory in AngularJS. It has a certain reference value. Now I share it with you. Friends in need can refer to it
In The controller listens to the $destroy event, which is triggered when the route jumps.
Usage:
$scope.$on("$destroy", function() { //清除配置,不然scroll会重复请求 })
A commonly used place is that when the page creates a timer and jumps to other pages, the timer is still executing. The second time you enter this page, the timer will be created repeatedly. controller, so this method is needed to destroy all timers of the current page when listening to leave the current route;
#Caching in Angular
Some small usage of $watch in angularJS
AngularJs: Interpretation of the usage of Directive instructions
Detailed explanation of the usage of ngOptions in AngularJS select
The above is the detailed content of A brief discussion on the usage of $destroy in AngularJS. For more information, please follow other related articles on the PHP Chinese website!