Possible Duplicate:
AngularJS - Route - How to match star (*) as a path
How do I specify wildcards in my routes -
$routeProvider
.when('/admin/*', {
templateUrl: 'admin.html',
controller: 'AdminCtrl'
})
So the above should work for /admin/users and /admin/users/1 or /admin/org/3. So there could be either one or two levels of path after admin. How do I do it ?
Currently AngularJS does not support regular expression in routes.
You can workaround as follows
app.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/admin', {templateUrl: 'admin.html', controller: 'AdminCtrl'})
.when('/admin/:type', {templateUrl: 'admin.html', controller: 'AdminCtrl'})
.when('/admin/:type/:id', {templateUrl: 'admin.html', controller: 'AdminCtrl'});
}]);
http://plnkr.co/edit/tBumW2oEqki2sEl1hjSc?p=preview
IMO, it is good idea to have the separate controller for both admin and users, unless otherwise you have some special requirement.