I have the following route:
$stateProvider.state('project.dashboard', {
url: '/:id/dashboard',
controller: 'Dashboard',
controllerAs: 'vm',
templateUrl: 'project/dashboard.tpl.html'
});
I'd like to have id be an optional parameter that gets resolved via a service if it's not defined.
so /project/dashboard also resolves to /project/ID/dashboard
What would the best way to accomplish this as I came up short looking at all the docs and google. Also if anyone has any tips for exposing the the current selected id via a service sitewide so my ui-sref's work that would be great :)
Note I was able to get this to somewhat work via this (but it really sucks and I don't like it)
$urlRouterProvider.when('/project/dashboard', function() {
// TODO: Resolve current project id from service.
return '/project/MY_PROJECT_ID/dashboard';
});