Nested routes but non-nested templates


#1

First of all, thank you all for your efforts in this forum.

I have this situation:

I need an url like this:

mysite.com/author/1/1/cart

but I don’t want nested template (every page is different and I don’t want same info in many page).

Is there a way to have that URL?

My actual router.js is this:

Router.map(function() {
  this.route('index', {path: '/'});
  this.route('login');
  this.route('authors', {path: '/authors'});
  this.route('author', {path: '/author/:author_id'});
  this.route('book', {path: '/book/:book_id'});
  this.route('cart', {path: '/cart/:cart_id'});
});

#2

In that case I don’t think you really technically want a nested route as much as you just want a url with multiple dynamic segments. Have you tried just making a route like this?

  this.route('cart', {path: '/author/:author_id/:book_id/cart'});

#3

@johnunclesam if you can provide the result by using upstairs‘ idea


#4

Thanks @dknutsen, I’m using your answer.

But I’m stucked here: Ember.js 2, transitionTo using multiple synamic segments in first level route

Can you help me?


#5

Sorry @GregWang, I don’t understand… What you need/want?


#6

See my answer in other thread