「もっと見る」というリンクをクリックして、アイテムの #each ループから単一のレコードを開こうとしています。リンクをクリックすると、単一の記事に移動します。Flow ルーターをセットアップして動作させましたが、入ってくるはずのデータが見えません。
単一の記事のテンプレート ヘルパーは次のようになります
Template.collectionSingle.helpers({
articles: function () {
var id = FlowRouter.getParam('_id')
return theCollection.findOne({_id: id});
}
});
}
私のルートは次のようになります
FlowRouter.route('/collection/:_id', {
name: 'collection',
action() {
BlazeLayout.render("AppLayout", {main: "collectionSingle"});
}
});
テンプレート「collectionSingle」は次のようになります
<template name="collectionSingle">
<h1>{{title}}</h1>
<h1>This is a test</h1>
<img src="{{thumbnail}}" alt="" />
</template>
http://localhost:3000/collection/thePublication-0に移動する と、「これはテストです」というテスト メッセージだけが表示されますが、{{title}} もサムネイルも表示されません。
さらに、私が変更すると:
return theCollection.findOne({_id: id});
私のコレクションの別の 1 つに:
return OtherCollection.findOne({_id: id});
http://localhost:3000/collection/thePublication-0
同じまま。
記事ごとに 1 つの記事ページを作成し、それらをフロー ルーターに適切にリンクするにはどうすればよいですか?