user3213821
user3213821

Reputation: 229

Load Multiple Templates Dynamically in Meteor JS?

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

Answers (1)

Hubert OG
Hubert OG

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

Related Questions