【问题标题】:How do templates work in Meteor?Meteor 中的模板如何工作?
【发布时间】:2014-11-18 19:12:23
【问题描述】:

我尝试 Meteor 并在 Mongo 中有这样的对象:

{ _id: iureuyhfiwuyerbe, "title": "title", "channel": "http://...", "desc": "description", "items" : [{ "title" : "This is title", "description" : "This is description", "link" : "http://123435", "pubDate" : "16 Oct 2014 20:46:00 +0400" }, { }, { } ... ] }

此消息来自 RSS 来源。我在 Db 中有许多相同的文档,它们都有自己的 ID。 我计划使用<select> 切换 RSS 频道并显示所选频道的新闻项目。我需要绑定这两个值。如何?我不明白如何在客户端显示此数组中每个对象的项数组值?标题、描述等

我的这段 HTML

<template name="newsList">
    <div class="container-fluid">
        {{> channel}}
    </div>
    <div class="container-fluid">
        {{#each items}}
            {{> item}}
        {{/each}}
    </div>
</template>

我看到频道,但没有看到项目。 如何在客户端调试代码以查看模板中的变量?我使用 Webstorm 9。调试器不会在模板中的断点处停止。

谢谢。

【问题讨论】:

  • 尝试更深入地了解项目。每个items.title

标签: meteor


【解决方案1】:

制作项目模板..

显示频道到频道的策略相同。

{{> items}}

{{item.title}}, {{item.description}} // and more..

【讨论】:

    猜你喜欢
    • 2013-09-17
    • 1970-01-01
    • 2015-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多