mardi 15 mars 2016

Can Route model observe applicationController props?

I'm building ember app, and I have date selector at the top and a few tabs. Each tab represents a model to work with, but all models need date selector. So I store the date selector values as applicationController properties, and I've reached the point where I need to load data with store.query("Model", {date: applicationController.date}) and now I'm lost. If I use ModelController with hooks like:

export default Ember.Controller.extend({
    appController: Ember.inject.controller('application'),
    myNeedData: function() {
        this.store.findAll('myNeedData',
             {date: this.get('appController').get('selectedUrlDate')}
        );
    }.property('appController.selectedUrlDate')
})

everything actually works, but it is a hack. So I need to load model data through Route's model(). But how can I pass applicationController property to Route and make it observe the changes?

Aucun commentaire:

Enregistrer un commentaire