0
我需要在運行方法中調用工廠。是否有可能? 工廠調用返回一個對象數組。 我的代碼是:如何在angular js中的.run方法中調用讀取json文件的工廠?是否可能?
myApp.run(function($rootScope, $location, $route, AuthService) {
$rootScope.$on('$routeChangeStart',
function(event, next, current) {
$rootScope.menuPermission = next.access.restricted
/***Need to call a factory here***/
AuthService.getUserStatus()
.then(function() {
if (next.access.restricted && !AuthService.isLoggedIn()) {
$location.path('/login');
$route.reload();
}
});
});
});
絕對有可能..會很容易幫助.. – tanmay