1
我是Meteor的新手。我设置在铁的数据上下文:路由器如下:如何在模板助手中获得Iron路由器数据上下文
Router.route('/:index', {
name:'randomText',
template: 'textsRandom',
data: function(){
textcol: Text.findOne({index: this.params.index})
}
}
而且在模板textsRandom,我想访问textcol
的助手,因为我想以后更改的特定文字的颜色中的文本。
Template.textRandom.helpers({
mytexts: function(){
var texts = //code here to get textcol in router.js
//get some words from texts and change their colors
return texts;
}
})
有关如何做到这一点的任何建议?非常感谢