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})
未定義を返します。
代わりに、「ストーリー」テンプレートは「ストーリーへようこそ:」というテキストでレンダリングされます。
私は何が欠けていますか?