Meteor JS:动态布局模板

Meteor JS: Dynamic Layout Template

我想使布局模板动态化。布局模板的值将使用 Meteor.call 'getLayoutTemplate' 在服务器中获取。我应该把 Meteor.call 放在哪里?它应该等到它获取 Meteor.call 的值。有什么想法吗?

Router.configure
  layoutTemplate: ????
  notFoundTemplate: 'notFound'

我会将方法调用放在 onAfterAction 挂钩中,然后根据调用结果设置 layoutTemplate

Router.route('/route', {
  name: 'route',
  onAfterAction: function() {
    var routerInstance = this;
    Meteor.call('method', function(error, result) {
      routerInstance.layoutTemplate = result;
    });
  }
});