I want to make the layout template dynamic. The value of the layout template would be fetch in the server using a Meteor.call 'getLayoutTemplate'. Where shall I put the Meteor.call? And it should wait until it fetches the value of the Meteor.call. Any ideas?
Router.configure
layoutTemplate: ????
notFoundTemplate: 'notFound'
I would put the method call in a onAfterAction
hook and then set the layoutTemplate
depending on the call's result:
Router.route('/route', {
name: 'route',
onAfterAction: function() {
var routerInstance = this;
Meteor.call('method', function(error, result) {
routerInstance.layoutTemplate = result;
});
}
});