lundi 22 mai 2017

Ember combining route data

I have a situation where I have a route extending another route but will add more data to this new route. What made it tricky is we want to merge the new data with the existing base route.

I can do this syncronously in the model hook with

return Ember.merge(this._super(...arguments), {
        foo : 123
    });

But how can I retrieve data aysncrounasly and still use this Ember.merge, ie something like

model(){
  return Ember.merge(this._super(...arguments), {
            foo : 123
           baa: store.get('smthElse)
        });
}

will give me back a model with baa as a promise object, not with its resolved value.

I tried returning the Ember.merge inside of the store.get('smthElse).then but the this._super(...arguments) threw undefined errors.




Aucun commentaire:

Enregistrer un commentaire