Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //----------- Jeito Feio
- // Routes
- // ...
- controller: "UserController",
- controllerAs: "$ctrl",
- resolve: {
- user: ($stateParams, UserService) => UserService.getUser($stateParams.id);
- }
- // ...
- // Controller
- function UserController(user){
- this.user = user;
- }
- // ...
- //------------ Jeito Lindo
- // Routes
- // ...
- controller: "UserController",
- controllerAs: "$ctrl",
- resolve: {
- user: UserController => UserController.resolve();
- }
- // ...
- // Controller
- function UserController($stateParams, UserService){
- this.resolve = () => {
- return UserService.getUser($stateParams.id).then(user => this.user = user);
- }
- }
- // ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement