angularjs - Set Multiple Role Angular js -


how set multiple role in angular.js $routeprovider

config.$inject = ['$routeprovider'];     function config($routeprovider) {          $routeprovider.when('/dashboard', {             templateurl: 'views/dashboard.html',             controller: "dashboardctrl"          })              .when("/readmyforms", {                 templateurl: "views/readmyforms.html",                 controller: "readmyforms",                 role: "admin"              }) } 

i want set multiple role here

role: "admin" , role: "manager"

add constant service roles

.constant('user_roles', {     manager:'manager',     admin:'admin' }); 

add data variable in $routeprovider , pass roles authorizedroles

data: {   authorizedroles: [user_roles.manager, user_roles.admin] } 

and use $routechangestart action know user allowed on login.
hope helps.


Comments