【发布时间】:2013-08-21 15:52:05
【问题描述】:
我希望我的 Meteor 应用程序使用 IronRouter 进行客户端路由。
我的路由代码如下:
Router.map(function() {
this.route('story', {
path: '/story/:_id',
data: function() {
return Stories.findOne({displayId: +this.params._id});
},
notFound: 'storyNotFound'
});
});
我有2个模板对应这条路线:
<template name="story">
Welcome to story: {{this.displayId}}.
</template>
<template name="storyNotFound">
Story not found
</template>
问题:“storyNotFound”模板从不渲染,即使在
Stories.findOne({displayId: +this.params._id})
返回未定义。
相反,“故事”模板使用文本“欢迎来到故事:”呈现。
我错过了什么?
【问题讨论】:
标签: javascript meteor iron-router