Javascript 是否将'this.data'的上下文转移到Blaze/Meteor中的其他模板?
我有一条收集数据的路线Javascript 是否将'this.data'的上下文转移到Blaze/Meteor中的其他模板?,javascript,meteor,meteor-blaze,Javascript,Meteor,Meteor Blaze,我有一条收集数据的路线 Router.map(function () { this.route('Players.guild', { path: '/players/guild/:guildId', template: 'GuildPlayerList', waitOn: function () { return Meteor.subscribe('guild_players', this.params.guildId); }, data:
Router.map(function () {
this.route('Players.guild', {
path: '/players/guild/:guildId',
template: 'GuildPlayerList',
waitOn: function () {
return Meteor.subscribe('guild_players', this.params.guildId);
},
data: function () {
return Players.find({ guildId: this.params.guildId });
}
});
});
然后,我有一个简单的模板
template(name="GuildPlayerList")
+ionList
+each this
+ionItem avatar=true ion-data-modal="_playerModalView"
img(src="{{ imageId store='PlayerThumbnails' }}" alt="{{ name }}")
h2 {{ name }}
template(name="_playerModalView")
// I want the current player in the +each to push its context of this here
+ionModal title="{{ name }}"
然而,问题是,当我加载模态时,这个上下文似乎发生了变化。在其他情况下,我使用了u.bind来推送上下文,但是如何使用blaze模板来实现这一点呢?我没有完全遵循您的语法,您也没有解释ion的内容是什么,但是在常规html语法中,您可以简单地为动态包含的模板提供一个数据参数,如中所述 ,因此在您的情况下,但html语法:
{{> _playerModalView data=this}}
您在模板中使用的语法是什么?