jeudi 18 août 2016

Using Ember.set to change a value, getting error that I have to use

In my application, I have to update a record (eventToUpdate) with the data from another object (updatedEvent). To do this, I use the following code:

editEvent (updatedEvent, eventToUpdate) {
  eventToUpdate.set('name', updatedEvent.name);
  eventToUpdate.set('matching', updatedEvent.matching);
  eventToUpdate.set('dcfEvent', updatedEvent.dcfEvent);

  eventToUpdate.save().then(() => {
    toastr.success('Event updated');
  }).catch((error) => {
    toastr.error('There occured an error while trying to update the event');
    console.log(error);
  });
},

When I try to update the event, I get the following error:

Assertion Failed: You must use Ember.set() to set the `name` property (of [object Object]) to `DCF tests`."

I use Ember.js 1.13




Aucun commentaire:

Enregistrer un commentaire