Taurus
Taurus

Reputation: 157

How to get Template.dynamic to work

I tried ,but i cant get it to work! i changed the value of Template in many ways, but still not working.

In html >>

<body>

    {{> Template.dynamic template=Template data=data}}

</body>

In Meteor.isClient >>

  Template.body.helpers({
    'Template': function() {
      return page.template;
    },
    'data': function() {
      return page.getTemplate();
    }
  });

I'm using the last version, 1.1.0.2

Upvotes: 2

Views: 48

Answers (2)

Tom Freudenberg
Tom Freudenberg

Reputation: 1367

You asked that in another thread as well and I made a MeteorPad for that:

http://meteorpad.com/pad/oPhK4KqjiSztRSa9K/SimpleDynamicTemplateSwitch

Cheers, Tom

Ref to the similar thread: How to force Template.dynamic to re render

Upvotes: 1

David Weldon
David Weldon

Reputation: 64342

A few suggestions:

  1. Make sure page.template is a string. It should be the name of the template and not a template instance.
  2. Make sure page.getTemplate() is a simple object - this should be a template context and not a template instance.
  3. It may be that the name Template for your helper causes some kind of conflict. Try templateName or something more descriptive.

Upvotes: 2

Related Questions