Home >Web Front-end >JS Tutorial >A brief discussion on the usage of $destroy in AngularJS

A brief discussion on the usage of $destroy in AngularJS

零到壹度
零到壹度Original
2018-04-21 11:20:582549browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn