How do I Swap Template without Changing Route?

Hello Meteorites,

Is there a way I can change the template that displays on a particular route without actually changing the route? let’s say I have a template that renders User Info and I want to replace it with another template that Edits the userinfo without changing the route from /dashboard to /edit-profile.

well, tou can easily do something like this:

<template name="parent">
  {{#if variableResult }}
    {{> childTemplate1}}
  {{else}}
    {{> childTemplate2}}
  {{/if}}
</template>

Thank you for your response. Pardon me if my questions are a bit odd but what could be variableResult be?

result of template helper.
which for example returns result of Session.get('someVariable');

Ahh okay! let me try it out.

So I am trying to achieve a wizard like feel by changing the Form that displays on each step.

When the first form is completed, I want to set the next step as active and render a new form without changing the route.

If you are on IronRouter simply

Router.current().render('<templateName>');
1 Like

Is there a better way to do this? If you have several different views (semantically, not Blaze.view objects or anything like that), then do you really have to put in a giant chain of {{#if}} blocks, each tied to a boolean helper?

Template.dynamic

1 Like