WoShiNiBaBa WoShiNiBaBa - 10 months ago 42
HTML Question

Cannot go back to default templates in meteor

So I'm using 4 templates in one html page. Template 1 is the default template and whenever you go to this html page you should see it.

However, after I navigate through the other templates and other html pages, when I go back to this page, it will show me the template I was in when I left that page instead of the default template.


<template name = "Page1">
<div class = "events">
{{>Template.dynamic template=selector}}

<template name = "template1">...</template>
<template name = "template2">...</template>
<template name = "template3">...</template>
<template name = "template4">...</template>


if(Meteor.isClient) {

Template.showEvent.helpers ({
selector: function () {
return Session.get("selector");

Template.showEvent.events ({
'click #temp2': function(){

...template 2, 3, 4...

Here is the code


Session.setDefault("selector","eventDetailPage"); is presumably what you use to keep track of which template1/template2/... is rendered. It's only getting called upon initialization with the web browser.

If you want to go back to the default page whenever you come back to page1, you'll want something like this instead.

Template.Page1.onRendered(function() {