You can use a regex to determine your route, and then parse the URL to get a child identifier, for example:
$stateProvider.state('person', {
url: '/person/:id',
views: {
'': {
templateUrl: 'parentTemplate.html',
controller: 'ParentCtrl'
}
}
}).state('child', {
url: '/person/:id/{path:.*}',
templateUrl: function(params) {
var path = params.path.split('/').reverse(),
childId = path[0];
return 'childTemplate.html';
},
controller: 'ChildCtrl'
});
source
share