why $routeChangeSuccess never gets called?

后端 未结 2 1639
一生所求
一生所求 2020-12-15 20:22

I am doing something similar to below on my app but I am just not able to get the routeChangeSuccess event.

var myapp = angular.module(\'myapp\', [\"ui.rout         


        
相关标签:
2条回答
  • 2020-12-15 20:37

    Please, check this wiki: State Change Events. An extract:

    • $stateChangeSuccess - fired once the state transition is complete.

      $scope.$on('$stateChangeSuccess',
      function(event, toState, toParams, fromState, fromParams){ ... })

    So instead of the $routeChangeSuccess use the $stateChangeSuccess.

    To get more detailed information about all available events, check the wiki Events. Here you can find that the suitable for you, could be event $viewContentLoaded...

    0 讨论(0)
  • 2020-12-15 20:55

    stateChange events are now deprecated and removed, use transitions instead.

    $transitions.onSuccess({}, function () {
        console.log("state changed");
    });
    
    0 讨论(0)
提交回复
热议问题