Javascript 流星:IronRouter不会触发notFound规则

Javascript 流星:IronRouter不会触发notFound规则,javascript,meteor,iron-router,Javascript,Meteor,Iron Router,我希望我的Meteor应用程序用于客户端路由 我的路由代码如下所示: Router.map(function() { this.route('story', { path: '/story/:_id', data: function() { return Stories.findOne({displayId: +this.params._id}); }, notFound: 'storyNotFo

我希望我的Meteor应用程序用于客户端路由

我的路由代码如下所示:

Router.map(function() { 
    this.route('story', {
        path: '/story/:_id',
        data: function() {
            return Stories.findOne({displayId: +this.params._id}); 
        },
        notFound: 'storyNotFound'
    });
});
我有两个与此路线对应的模板:

<template name="story">
    Welcome to story: {{this.displayId}}.
</template>

<template name="storyNotFound">
    Story not found
</template>
返回未定义的

相反,“故事”模板使用文本“Welcome to story:”呈现


我缺少什么?

您是否尝试过用
notFoundTemplate
替换
notFound:
?Iron Router示例使用了
notFound
,但我只能在源代码中找到
notFoundTemplate
,这对我很有用

Router.map(function() { 
    this.route('story', {
        path: '/story/:_id',
        data: function() {
            return Stories.findOne({displayId: +this.params._id}); 
        },
        notFoundTemplate: 'storyNotFound'
    });
});

嘿,抱歉搞混了。我在开发部门做了很多清理工作。通常,任何适用于模板的内容都会在选项的末尾添加“模板”。notFoundTemplate、layoutTemplate、yieldTemplates、template。
Router.map(function() { 
    this.route('story', {
        path: '/story/:_id',
        data: function() {
            return Stories.findOne({displayId: +this.params._id}); 
        },
        notFoundTemplate: 'storyNotFound'
    });
});