lundi 5 juin 2017

Model hook loading with refreshModel

My Route currently looks like:

export default Ember.Route.extend({
    queryParams: {
        dateFrom: { refreshModel: true },
        dateTo: { refreshModel: true }
    },

    model(params) {
        return this.store.findRecord('foo', params.id, {
            adapterOptions: {
                filter: {
                    dateFrom: params.dateFrom,
                    dateTo: params.dateTo,
                }
            }
        });
    },
});

When the query param is changed on the route, the model hook is fired again. Is there a way I can tell if the model hook is in a loading state? I have tried model.isLoading in my template, but this doesn't seem to update when refreshModel is triggered.

I don't want to use loading substates, as I need a property I can pass into components.




Aucun commentaire:

Enregistrer un commentaire