Iron Router / Meteor - 如何将数据从控制器传递到模板?

Iron Router / Meteor - How can I pass data from the controller to the template?

我正在处理用户个人资料页面,我正在尝试将数据从控制器传递到模板助手。这是我的控制器:

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
}
});

有人可以指导我如何在模板助手中传递我在控制器中定义的数据吗??

谢谢!!

摆脱助手并改用此模式:

data: function(){
  return {
    user: Meteor.users.findOne(this.params._id)
  };
}

这样您就可以在模板中引用 user,因为数据上下文将设置为路由数据函数的结果。