【发布时间】:2014-06-25 07:37:05
【问题描述】:
我认为这个问题与这里已经提出的问题不同。我一直在为此苦苦挣扎,找不到好的解决方案。
假设是这样的:
//ResourceOne { name: "foobar" } ... ResourceTwo { name: "donuts" }
Resources = new Meteor.Collection('resources');
//{ input: ResourceOneID, output: ResourceTwoID }
Connections = new Meteor.Collection('connections');
连接将资源连接到其他资源,仅存储它们的_ids。
我想在表单中显示连接列表
foobar --> donuts
我到底是怎么做到的?
现在我有:
{{#each connections}}
<a href="#">{{ input_name }} --> {{ output_name }}</a>
{{/each}}
由模板助手提供支持:
input_name: function() {
return Resources.find( { _id: this.input } ).fetch()[0].name;
}
这可行,但只要页面没有完全刷新就会失败。
有什么更好的方法来做到这一点?
【问题讨论】:
标签: javascript meteor meteor-blaze