vendredi 8 décembre 2017

Nested routes in ember with several ids

I am at the start of creating a new ember application. I am quite familiar with Ember 1.x, but this is my first real dive into 2.x.

I am not quite sure about what is nesting and what is not in the terms of ember routing, but what I think I am trying to accomplish is a bit of a nested route.

Perhaps easier if I tell you about how I'd wish it too look through the url. https://localhost:4200/modules/123/block/123/version/123 where modules is the main route which will list specifically all modules. When I click on a specific module, I want it to load the module in the right column of the page with the sidebar still intact to the left. From there I can click onto one of the blocks which is in relationship to the module, and then to the version.

How can a nested routing like this most easily be setup? I am not clear about the terms here, so feel free to correct me.

This is basically how I thought so far, without success:

Router.map(function () {
  this.route('modules', () => {
    this.route('module', { path: '/modules/:module_id' }, () => {
      this.route('block', { path: '/block/:block_id' }, () => {
        this.route('version', { path: '/version/:version_id' })
      });
    });
  });

  this.route('login');
});




Aucun commentaire:

Enregistrer un commentaire