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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -