diff --git a/src/router.js b/src/router.js index b7bd3f38..24ce0a70 100644 --- a/src/router.js +++ b/src/router.js @@ -452,13 +452,21 @@ function validateRouteConfig(config: RouteConfig, routes: Array): void { } function evaluateNavigationStrategy(instruction: NavigationInstruction, evaluator: Function, context: any): Promise { - return Promise.resolve(evaluator.call(context, instruction)).then(() => { + return Promise.resolve(evaluator.call(context, instruction)).then((modules?: string | {[viewportname: string]: moduleId}) => { if (!('viewPorts' in instruction.config)) { - instruction.config.viewPorts = { - 'default': { - moduleId: instruction.config.moduleId - } - }; + instruction.config.viewPorts = {}; + } + + if (typeof modules === 'string') { + modules = {'default': modules}; + } else if (modules === undefined) { + modules = {'default': instruction.config.moduleId}; + } + + for (let key in modules) { + let vp = instruction.config.viewPorts[key] || {}; + vp.moduleId = modules[key]; + instruction.config.viewPorts[key] = vp; } return instruction;