Looking to integrate an AngularJS router into my application, I've defined a route in
angular.module('MyModule').config()
:
$routeProvider
.when('/:stepId?', {
templateUrl: EditorApp.webDir + 'bundles/innovapath/angularjs/Step/Partial/step-form.html',
controller: 'StepFormCtrl',
controllerAs: 'stepFormCtrl',
resolve: {
step: [
'$route',
'PathService',
function($route, PathService) {
var step = null;
// Retrieve the step from route ID
if ($route.current.params && $route.current.params.stepId) {
step = PathService.getStep($route.current.params.stepId);
}
return step;
}
],
inheritedResources: [
'$route',
'PathService',
function($route, PathService) {
var inherited = [];
var step = PathService.getStep($route.current.params.stepId);
if (angular.isDefined(step) && angular.isObject(step)) {
var path = PathService.getPath();
// Grab inherited resources
inherited = PathService.getStepInheritedResources(path.steps, step);
}
return inherited;
}
]
}
})
.otherwise({
redirectTo: '/:stepId?'
});
Despite listening for the $routeChangeStart
event, it does not fire when the page loads. This issue persists even on page refresh with F5
.
The route resolution works flawlessly when using internal links within the application.
Seeking suggestions on why the route is not being resolved properly?