相关疑难解决方法(0)

Angular:如何使用一个解析我的应用程序的所有路由

我想解决为我的应用程序的所有页面加载当前用户的承诺.现在我在路由的每个$ 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

30
推荐指数
2
解决办法
1万
查看次数

标签 统计

angularjs ×1