dimanche 22 janvier 2017

How to find child route inside a parent route?

I have a nested route (see below).

this.route('home', {
    path: '/'
}, function() {
    this.route('a', {
        path: '/a'
    });
    this.route('b', {
        path: '/b'
    });
});

Inside parent route home, I define a function called reloadModel. I try to reload the model from the controller but failed (produce an undefeind function error).

    reloadModel() {
        const controller = this.controllerFor('home/a');
        controller.get('model').reload();
    },

I would like to reload the child route's model from the parent route; however, I do now know to can I get the child route?

My Question

How can I refresh model in route a OR b from route home?

Any hint is appreciated.




Aucun commentaire:

Enregistrer un commentaire