不知怎的,我用这两个参数去监听路由的变化,如果,只不过是一个路由跳到下一个路由,其中,用了routeChangeSuccess发了12次请求,
routechangestart发了24次请求。
怎么不会是一次呢??我只不过是跳转一次页面而已。惊愕。看代码:
var routeApp = angular.module('routeApp', ['ngRoute']).run(function ($rootScope, authService) {
$rootScope.$on('$routeChangeSuccess', function (evt, next, current) {
//在前台,后台,标注,都发现这里多次请求,
console.log("發動請求:");
if (authService.ifHasLogin()) {
$rootScope.isShow = false;
} else {
$rootScope.isShow = true;
}
});
});