search

Home  >  Q&A  >  body text

angular.js - Is it possible to set trigger events when ui-router switches routes?

I polled the server with $interval in the controller of a route. When switching to another route, the $interval was not canceled.
Is there an event for ui-router to switch routes?
In addition It’s not very clear that $scope is not destroyed when switching routes (¥destory is not triggered), but the link to a route scope will be executed once every time it is switched to a route?

滿天的星座滿天的星座2873 days ago608

reply all(1)I'll reply

  • 迷茫

    迷茫2017-05-15 16:57:16

    $rootScope.$on('$stateChangeStart', function(){})

    reply
    0
  • Cancelreply