Nested route, get id or model of "parent" route


#1

Got my routes as follows:

  this.route('stuff', { path: 'stuff/:id' }, function(){
    this.route('oldstuff');
    this.route('newstuff');    
  });

The “stuff” route get the id passed, load the model and the view with data just fine. On this view is and {{outlet}} and links to “oldstuff” and “newstuff”, which upon clicked load those templates in the parent’s “outlet”.

My problem is that in the route files for “oldstuff” and “newstuff” I cannot get the model of the parent (modelFor) nor the id in the route, so I’m not sure what I misunderstood while learning?


#2

You need to pass model in stuff route to oldstuff/newstuff route. For example if you link them by link-to :

{{#link-to 'stuff.oldstuff' model}}OLD{{/link-to}}