2
如何在Meteor JS
中加载多个模板?我知道如何动态加载一个模板。但没有得到加载多个模板。请参阅加载单个模板的下面的代码&建议我如何加载多个模板?在Meteor JS中动态加载多个模板?
JS代码:
Meteor.startup(function()
{
Session.set('currentTemplate', 'login');
});
Template.content.helpers
({
'renderTemplate': function()
{
if(Session.get('currentTemplate') == undefined)
{
Session.set('currentTemplate', 'login');
}
return new Handlebars.SafeString(Template[Session.get('currentTemplate')]({dataKey: '0'}));
}
})
您可能需要考虑使用[router](https://github.com/EventedMind/iron-router)。 –