Here’s how router.js file looks :
...
this.route('institute', function() {
this.route('profile', { path: '/profile/:id' });
this.route('edit', { path: '/edit/:id/' }, function() {
this.route('contact');
...
});
...
});
...
And here’s the route for edit:
export default Ember.Route.extend( {
model: function(params) {
return Ember.RSVP.hash({
id: params.id,
institute: this.store.findRecord('institute', params.id),
});
},
setupController(controller, models) {
this._super(controller, models);
controller.set('institute', models.institute);
controller.set('instituteId', models.id);
},
});
How to use the parent ( edit ) model in the subroute ( contact )?
I’ve tried this:
export default Ember.Route.extend({
model: function() {
this.modelFor('edit')
},
setupController(controller, models) {
this._super(controller, models);
controller.set('institute', models);
},
});
But nothing. How to get data in the view, say edit.hbs
<h1>Contact : {{insitute.phone}}</h1>