如何在 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'}));
}
})
最佳答案
将一个模板加载到另一个模板中:
<template name="oneTemplate">
{{> anotherTemplate}}
</template>
要根据 url 加载不同的模板,最好使用 Iron Router .
关于javascript - 在 Meteor JS 中动态加载多个模板?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21478328/