diff --git a/src/activation.js b/src/activation.js index 41f71205..39626d5c 100644 --- a/src/activation.js +++ b/src/activation.js @@ -158,9 +158,9 @@ function findActivatable(navigationContext, callbackName, list, router) { if (viewPortPlan.childNavigationContext) { findActivatable( - viewPortPlan.childNavigationContext, - callbackName, - list, + viewPortPlan.childNavigationContext, + callbackName, + list, controller.router || router ); } @@ -170,22 +170,25 @@ function findActivatable(navigationContext, callbackName, list, router) { } function shouldContinue(output, router) { - if (output instanceof Error) { + if(output instanceof Error) { return false; } if(isNavigationCommand(output)){ - output.router = router; + if(typeof output.setRouter === 'function') { + output.setRouter(router); + } + return !!output.shouldContinueProcessing; } - if (typeof output == 'string') { + if(typeof output === 'string') { return affirmations.indexOf(value.toLowerCase()) !== -1; } - if (typeof output == 'undefined') { + if(typeof output === 'undefined') { return true; } return output; -} \ No newline at end of file +} diff --git a/src/navigation-commands.js b/src/navigation-commands.js index 9d78f46e..115586af 100644 --- a/src/navigation-commands.js +++ b/src/navigation-commands.js @@ -21,6 +21,16 @@ export class Redirect{ this.shouldContinueProcessing = false; } + /** + * Called by the activation system to set the child router. + * + * @method setRouter + * @param {Router} router + */ + setRouter(router){ + this.router = router; + } + /** * Called by the navigation pipeline to navigate. * @@ -30,4 +40,4 @@ export class Redirect{ navigate(appRouter){ (this.router || appRouter).navigate(this.url, { trigger: true, replace: true }); } -} \ No newline at end of file +}