我想解决为我的应用程序的所有页面加载当前用户的承诺.现在我在路由的每个$ routeProvider.when()中重复解析.
$routeProvider.when('/users/edit/:userId', {
templateUrl: 'app/app/assets/partials/user-edit.html',
controller: 'UserEditController',
resolve:{
'currentUser':function( UserService){
return UserService.getCurrentUser();
}
}
});
$routeProvider.when('/staff_profil/edit', {
templateUrl: 'app/app/assets/partials/profil-edit.html',
controller: 'ProfilEditController',
resolve:{
'currentUser':function( UserService){
return UserService.getCurrentUser();
}
}
});
Run Code Online (Sandbox Code Playgroud)
我的目标是为所有路线解析当前用户而不重复.
angularjs ×1