angularjs - How to manage the output page in Angular JS - routeProvider? -


my project built on php , has pages on angular js. there 3 types of accounts in system. authorization system based on php/mysql.

for each account have personal.html template. when user logged via account(1) need show him template /public/html/personal.html route, if account(2) - template /public/html/personal2.html .etc. so, path /profile/personal/:type same each.

how can manage accounts pages level of security?

i use routeprovider:

$routeprovider          .when('/profile/personal/:type', {              templateurl: '/public/html/personal.html',              controller: 'profilecontroller'   }) 

you can use function templateurl parameter , use select template current account type:

$routeprovider     .when('/profile/personal/:type', {         templateurl: function(params)  {             switch(params.type) {                 case 1:                     return: '/public/html/personal1.html';             }         },         controller: 'profilecontroller'     }); 

Comments