Reputation: 2325
I am using AngularJs#1.3.8 with ngRoute injected in my main module. So, giving the current route:
.when('/users', {
templateUrl : 'template.html',
controller: 'Users',
controllerAs : 'Users',
resolve: {
function (userService) {
return userService.initModuleRoles('/users', ['R-USERS']);
}
}
In the service method initModuleRoles the first parameter: '/users' can be replace with non hard coded variable ? (something like $route.url)
Upvotes: 0
Views: 86
Reputation: 3124
You can pass params to your resolve:
.when('/users', {
templateUrl: 'template.html',
controller: 'Users',
controllerAs: 'Users',
resolve: {
lazy: ['userService','$location', function(userService,$location) {
return userService.initModuleRoles($location.url(), ['R-USERS']);
}]
}
});
Upvotes: 1