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