【发布时间】:2016-06-14 13:36:48
【问题描述】:
我是 Meteor 的新手。我在 iron:router 中设置数据上下文如下:
Router.route('/:index', {
name:'randomText',
template: 'textsRandom',
data: function(){
textcol: Text.findOne({index: this.params.index})
}
}
而在模板 textsRandom 中,我想在 helper 中访问 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;
}
})
关于如何做到这一点的任何建议?非常感谢
【问题讨论】:
标签: javascript meteor iron-router datacontext