angular-route-segment
angular-route-segment copied to clipboard
Custom parameters inside segment
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?
+1
+1