1
我正在用户配置文件页面上工作,我试图将数据从控制器传递给模板助手。这里是我的控制器:铁路路由器/流星 - 如何将数据从控制器传递到模板?
usersDetailController = RouteController.extend({
waitOn: function() {
Meteor.subscribe('userProfileExtended', this.params._id);
},
data: function(){
console.log('info is ' + this.params._id);
var a = Meteor.users.findOne(this.params._id);
console.log(a);
return Meteor.users.findOne(this.params._id);
},
action: function() {
this.render('Users');
}
});
这里是我的模板帮手:
Template.Users.helpers({
user: function() {
//define user based on the data context from the route controller
}
});
有人可以给我如何通过我在模板辅助控制器定义的数据提供一些指导?
谢谢!
您是否尝试过使用会话? Session.set('someValue',this.params.id) – Ethaan 2015-03-31 16:01:10