mercredi 29 juillet 2015

Ember DS.Store.findAll() returns empty collection

Hey I need to modify some records which I get from the DataStore. If I add the following code in my router I can see that the requests get passed to my template, but I can't modify each request of the collection because the collection is empty.

model() {
  return this.store.findAll('user').then(function(users) {
    console.log(users.get('length')); // 0
    return users;
  });
}

I thought that the promise gets resolved when all the records have been fetched from the server but this doesn't seem to be the case. Or did I completely miss something.

I also tried to modify the model in the afterModel callback with the same result.

I'm using Ember 1.13.0 (with Ember-CLI), Ember-Data 1.13.4 and ember-cli-mirage for Mocking my HTTP Requests.




Aucun commentaire:

Enregistrer un commentaire