2014-07-09 156 views
1

这是我的路线:铁路由器和notFoundTemplate

this.route('showItem', { 
    path: '/item/:_id', 
    template: 'layout', 
    yieldTemplates: { 
     'content': {to: 'content'}, 
     'item_details': {to: 'details'} 
    }, 
    notFoundTemplate: 'notFound', 
    data: function() { 
     return null; //for test 
    } 
}) 

而且notFound模板,这很简单:

<template name="notFound"> 

    Not found! 

</template> 

而且我不明白,为什么总是呈现item_details永不notFound

回答

2

我认为这是铁路由器0.7他们补充说,你不得不对全局钩子切换的要求:

Router.onBeforeAction("dataNotFound"); 

这是一个没有找到模板。在this issue上有一些信息。这一变化背后的原因是您可以自定义决定是否找到数据的功能。

+0

谢谢!现在正在工作,但是...... :-)是否有可能渲染'不发现'而不是'item_details'?因为我的“内容” - 带有标记的地图。我不想重绘地图,只有细节部分 – none