Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

Use parent property in subroute

$
0
0

@itsmanojb wrote:

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>

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles