I have an Angular App using the great ui-router.
My setup looks like:
.config( function ($stateProvider, $urlRouterProvider) {
$stateProvider
// PROJECT DETAIL
.state('project', {
url: '/project/:projectId/',
resolve: {
/* some base api calls */
},
views: {
'task-list': {
templateUrl: 'partials/task_list.tmpl.html',
controller: 'TaskListCtrl',
resolve: {
tasks: function ($stateParams, ConcernService) {
return ConcernService.get('project-tasks/', $stateParams.projectId);
},
}
},
'concern-instance': {
/* some resolved variables */
}
}
})
.state('project.task', {
url: 'task/:taskId/',
views: {
'concern-instance@': {
/* some different resolved variables */
},
}
})
This all works like butter. However in my task_list
template when in state project.task
, I want to be able to access the taskId
param so I can highlight active nav links, even when the url is #/project/123/task/456/
the taskId
is empty. I understand that this is because templates only have access to params declared for that state. So if I want to get the taskId
in the project.task
state, how should I do it? Do I need to re-declare the task-list
in project.task
?