對於我的應用程序,我試圖對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}}
我想知道是什麼做到這一點的最佳方式?我聽說有望遠鏡應用程序的動態模板,但我不知道它對我的情況是否有用。