angular中$transitions.onSuccess监听路由变化

.run(["$transitions",function ($transitions, $state) {
    $transitions.onSuccess({}, function (transition) {
        var currentRoute = transition.to().name;
        if (currentRoute.indexOf("from") != -1) {
            //监听路由变化,当跳出from页面时执行内容
        } else {
           
        }
    });
}]);

  

posted @ 2018-04-20 10:14  芒果加冰  阅读(422)  评论(0编辑  收藏  举报