2

I'm trying to make a reactive menu using meteor session (to persist the view the user was).. but it is not working, the Session.get('currentView') get changed (teste in chrome console), but the page don't render again.

.html

<div class="col-1-1 menu" style="height: 42px;">
    <ul>
        <li><a class="dashButton" href="#"># Dashboard</a></li>
        <li><a class="myJobsButton"href="#">Jobs</a></li>
        <li><a class="helpPageButton"href="#">Help</a></li>
    </ul>
    <br style="clear:left"/>
</div>
{{#if currentViewIs "dashboard"}}
    {{> dashboard}}
{{else}}
    {{#if currentViewIs "myJobs"}}
        {{> myJobs}}
    {{else}}
        {{#if currentViewIs "helpPage"}}
            {{> helpPage}}
        {{else}}
            {{> dashboard}}
        {{/if}}
    {{/if}}
{{/if}}

client.js

Template.userPage.currentViewIs = function (view) {
    if( Session.get('currentView') == view)
        return true;
    return false;
};

Template.userPage.events({
    'click .dashButton': function (evt) {
        Session.set('currentView', 'dashboard');
  },
    'click .myJobsButton': function (evt) {
        Session.set('currentView', 'myJobs');
  },  
    'click .helpPageButton': function (evt) {
        Session.set('currentView', 'helpPage');
  }
});

1 Answer 1

2

It is working fine now: - Some weird bug in meteor for windows (win.meteor.com), after stop server and refresh chrome it worked as supposed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.