2014-12-07 14 views
0

我試圖表現出404頁NOTFOUND模板是這樣的:Iron-Router Display爲notFoundTemplate顯示不同的layoutTemplate?

Router.configure({ 
    loadingTemplate: 'loading', 
    notFoundTemplate: 'notFound', 
    layoutTemplate: 'layout' 
}); 

我的問題是,對於layoutTemplatenotFound一樣不同的路線只是身體404只{{>產量}}正在改變,

<template name="layout"> 
     {{> header}} 
     <div id="wrapper"> 
      {{> sidebar}} 
      <div id="main-content"> 
       {{> yield}} 
      </div> 
     </div> 

但我想顯示空白頁面,並沒有顯示我基本上只登錄後看到的頁面中管理,所以我的問題是我怎麼可以設置notFoundTemplatelayoutTemplate

回答

0

你所看到的實際上是正確的(和預期的)行爲。

但是,如果你真的想改變它,試試這樣做:

Router.onBeforeAction(function() { 
    if (!this.data()) { 
    this.layout("myLayoutForNotFoundPage"); 
    } 
    this.next(); 
}); 
相關問題