angular-route-segment icon indicating copy to clipboard operation
angular-route-segment copied to clipboard

Custom parameters inside segment

Open zacharynevin opened this issue 10 years ago • 2 comments

In $routeProvider, I would have custom paramters that would define the route access level:

$routeProvider.when({
  templateUrl: 'templateUrl.html',
  controller: 'MyController',
  access_level: ROUTE_ACCESS_LEVELS.ONLY_LOGGED_IN
})

I see in the test spec that you are adding in a custom hash - { test: 'A' }. How would I get the value of custom parameters in a $rootScope onChangeStart event?

Before I was doing

.run(['$rootScope', 'ROUTE_ACCESS_LEVELS', 'userService', function($rootScope, ROUTE_ACCESS_LEVELS)  {
  $rootScope.$on('$routeChangeStart',   function(evt, next, curr) {
    console.log(next.access_level)
    // do stuff with access_level

I can't seem to find the access_level parameter inside evt, next, or curr. Are custom parameters available in angular route segment?

zacharynevin avatar Aug 10 '14 21:08 zacharynevin

+1

ghost avatar Sep 22 '14 10:09 ghost

+1

enlightenmental avatar Jun 11 '15 20:06 enlightenmental