#each博客帖子没有显示

时间:2016-05-18 02:41:36

标签: meteor

我有一个包含博客帖子的集合,我试图让它们显示在页面上。下面的代码没有列出所有的博客文章,我不知道为什么。据我所知,这是出版。

路径:blog.html

{{#each Blog}}
    <p>{{details}}</p>
{{/each}}

路径:blog.js

Template.blog.onCreated(function() {
    var self = this;
    self.autorun(function(){
        var id = FlowRouter.getParam('id');
        self.subscribe('blog', id);
    });
});

路径:Blog mongoDB example

{
  "_id": "JvLqxFisXc3PLeqSh",
  "details": "Test three",
}

路径:publish.js

Meteor.publish('blog', function (id) {
  check(id, String);

  return Blog.find({}); 

});

1 个答案:

答案 0 :(得分:0)

我需要添加帮助器。

{{#each blogPost}}
    <p>{{details}}</p>
{{/each}}

路径:blog.html

{{1}}