对于我的应用程序,我试图对Widgets集合中的每个项目设置操作。一个widget项目包含一个url
(api rest)和一个period
。我们的目标是要遍历一个部件收集和做这样的事情:对收集项目执行特定操作
//Loop through collection
Meteor.setInterval(function(){
Meteor.call('getData', <Collection>.url,function(e,r){
if(e){
console.error(e);
}else{
//Display the data into the template
}
});
},<Collection>.period);
在模板我想要做这样的事情:
{{#each widgets}}
{{widgetItem}}
{{/each}}
我想知道是什么做到这一点的最佳方式?我听说有望远镜应用程序的动态模板,但我不知道它对我的情况是否有用。