Reputation: 229
How to load multiple templates in Meteor JS
? I know how to load a single template dynamically. But not getting to load multiple Templates.Please see the below code of loading single template & suggest me what to do for Load Multiple Templates?
JS Code :
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'}));
}
})
Upvotes: 2
Views: 704
Reputation: 19544
To load a template inside another one:
<template name="oneTemplate">
{{> anotherTemplate}}
</template>
To load a different template depending on the url, it's better to use Iron Router.
Upvotes: 1