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

零到壹度
Release: 2018-04-21 11:20:58
Original
2556 people have browsed it

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会重复请求
  })
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template