I'm currently working on a Durandal 2 application. I'm new to this technology and I read a lot of documentation on the subject but I encounter a problem in my website conception.
Most of my views have the same structure (header, menu, content, footer) which is defined in the shell but some pages (like the maintenance page) should not have header, menu and footer.
I've created my shell template but I can't find a way to deactivate the header/menu/footer for this specific view.
The user can't leave the maintenance page until a server call redirect him to the home page. (when the maintenance is over)
I've tried using composition :
<div data-bind="compose: headerModule"></div>
...
if (router.activeInstruction() !== null) {
if (router.activeInstruction().config.moduleId.length > 0) {
switch (router.activeInstruction().config.moduleId) {
case "pages/maintenance":
this.headerModule("");
break;
default:
this.headerModule(this.application.getFullModuleId('modules/header/header'));
break;
}
}
}
It works well when I load the page but not when I navigate through the website.
I've tried to use an event to handle this but it doesn't work neither :
router.on('router:navigation:attached', function() { /* same code as above */ });
Maybe I misunderstood something or maybe I do something wrong here but I didn't find a way to hide a module defined in the shell in specific page.
Is there any way to specify multiple "template"? Or, to make an analogy, to have multiple template layers, like master pages in asp.net?
Any idea how I can achieve this?
Thanks in advance...