I have an EmberJS application that uses Ember Data to fetch records from a JSONAPI. I need to load a model and it's relationships in one request. So I do this...
model(params){
return this.store.findRecord('foo-model', params['my-model_id'], {
include : [
'bar-model',
'baz-model.biz-model'
].join(',')
});
},
How do I wait until the model and all relationships are actually loaded before rendering the template?
My problem is that it seems a component is trying to use baz-model.biz-model (probably milliseconds) before it's actually finished loading which is causeing another request to the API -- this time to..
https://localhost:port/api/baz-model/{id}/biz-model
Aucun commentaire:
Enregistrer un commentaire