dimanche 17 janvier 2016

Update record in EmberJS without a network request

You can update records in emberjs doing the following:

this.store.findRecord('person', 1).then(function(tyrion) {
  // ...after the record has loaded
  tyrion.set('firstName', "Yollo");
});

However, this creates a network request. Assuming I want to pull the data from the store, I can do this:

var post = this.store.peekRecord('person', 1); // => no network request

This issue there is no promise/then for peek... how would I go about updating a record in the store, after using peek?




Aucun commentaire:

Enregistrer un commentaire