我想从流星中的集合中获取数据并使用帮助器将它传递给模板。流星不在html中显示来自集合的数据
这是我在收集代码:
Meteor.publish('displayCustomers', function tasksPublication() {
return Customers.find();
});
下面模板JS文件中的代码
Template.customerlist.onCreated(function() {
Meteor.subscribe('displayCustomers');
});
Template.customerlist.helpers({
displayCustomers :function(){
console.log(Customers.find({}));
return Customers.find({});
},
});
模板:
<template name="customerlist">
<h1>All registered users</h1>
{{#each displayCustomers}}
{{fname}}
{{/each}}
</template>
它只是显示HTML内容,即<h1>All registered users</h1>
我说在客户端的console.log和我一样可以在Firefox –
控制台选项卡中看到你尝试扩展?它会告诉你什么数据订阅正在检索 – mutdmour