Collections 我需要添加什么来呈现meteor文章集合中的每一篇文章?

Collections 我需要添加什么来呈现meteor文章集合中的每一篇文章?,collections,meteor,handlebars.js,meteorite,Collections,Meteor,Handlebars.js,Meteorite,我想呈现我的流星文章收藏中的每一篇文章。 (文件位于myProject/collections/collections.js中,因此它应可用于客户端和服务器) collections.js中的代码: Articles = new Meteor.Collection('articles'); 我已经安装了autopublish软件包,并且通过Chrome控制台在文章集合中插入了一个对象,并通过控制台使用:Articles.findOne() 到目前为止,我得到的是: <head>

我想呈现我的流星文章收藏中的每一篇文章。 (文件位于
myProject/collections/collections.js
中,因此它应可用于客户端和服务器)

collections.js中的代码:

Articles = new Meteor.Collection('articles');
我已经安装了autopublish软件包,并且通过Chrome控制台在文章集合中插入了一个对象,并通过控制台使用:
Articles.findOne()

到目前为止,我得到的是:

<head>
  <title>Articles</title>
</head>

<body>
  {{> main}}
</body>

文章
{{>main}
我的主模板是一个不会显示文章的模板

<template name="main">
  <div class="container-fluid">
    {{#each articles}}
      {{> article}}
    {{/each}}
  </div>
</template>

{{#每篇文章}
{{>文章}
{{/每个}}
我的文章模板应该为我的文章集合中的每个对象呈现,如下所示:

<template name="article">
  <div class="item well span4">
    <iframe height="{{height}}" src="{{src}}"></iframe>
    <hr>
    <h4 class="muted">{{name}}</h4>
    <p>{{description}}</p>  
   </div>
</template>


{{name}} {{description}}

我需要添加什么来呈现本文?如果我删除了自动发布软件包,我要怎么做才能呈现文章呢

我需要添加什么来呈现本文

您需要告诉您的
main
模板如何计算字段
articles
。您只需调用模板上的方法即可完成此操作

如果我被删除了,我要怎么做才能呈现这篇文章呢 自动发布包


您需要创建一个,这样客户端就可以通过它获取集合中的文档。

但是我该如何设置helpers方法呢
Template.main.articles=函数(){return articles.find();}-这也不会返回任何内容。我发现这方面的文档不太清楚。如果能在那里得到更多帮助,我将不胜感激-G@getJETsetTER我觉得你的助手是对的。然而,在我原来的帖子中,我可能写了
{{{articles}}
把你弄糊涂了。在模板中,您当然应该使用
{{{{each articles}}
,就像您所使用的一样。如果这不是问题,那么我不知道出了什么问题。我重新启动了meteor,现在它正在显示。谢谢你,佩佩。希望我能在校园里见到你(瓦拉!)
<template name="article">
  <div class="item well span4">
    <iframe height="{{height}}" src="{{src}}"></iframe>
    <hr>
    <h4 class="muted">{{name}}</h4>
    <p>{{description}}</p>  
   </div>
</template>