I have an application where routes are defined as follows:
angular.module('myApp').config(['$routeProvider', function ($routeProvider) {
'use strict';
$routeProvider
.when('/user-management', {
title: 'Manage: Users',
permissions: ['ADMINISTRATOR'],
templateUrl: 'views/user-management.html',
controller: 'UserCtrl'
})
.when('/group-management', {
title: 'Manage: Groups',
templateUrl: 'views/group-management.html',
controller: 'GroupManagementCtrl',
permissions: ['OPERATOR', 'ADMINISTRATOR']
})
...
In the controller, I would like to get this list of routes, as well as access permissions for each of the routes. This would have to hide the navigation elements for pages for which you do not have rights.
Is there a good way to get a list of routes and their associated permissions?
source
share