Navigate from menu

15 views
Skip to first unread message

Patrick Mulder

unread,
Dec 21, 2013, 3:25:22 AM12/21/13
to thor...@googlegroups.com
Hi,

just wondering if someone has an idea how to do this best.

I have a small view used as menu that looks like:

define([
  'view',
  'hbs!templates/hello-world/index'
], function(View, template) {
  return View.extend({
    name: 'hello-world/index',
    template: template,
    events: {
      'click .post': 'showPost',
      'click .gallery': 'showGallery'
    },
    showPost: function(ev) {
      ev.preventDefault();
      console.log("hello");
    },
    showGallery: function(ev) {
      ev.preventDefault();
      console.log("hello");
    }
  });
});

However, I wonder how to best call the Router here to navigate to the different parts in application?

Patrick

Patrick Mulder

unread,
Dec 21, 2013, 6:13:57 AM12/21/13
to thor...@googlegroups.com
I've taken a different approach, rendering the menu an main content separately with:

    index: function() {
      var view = new PostView();
      RootView.getInstance().setView(view);
      var sidebar = new Sidebar({el: $("#sidebar")});
      sidebar.render();
    },

hope to write a blog post soon.

Reply all
Reply to author
Forward
0 new messages