lundi 29 décembre 2014

Ember model not saving changes from itemController

In a parentController I'm trying to save changes that are made in an itemController. I can see that the model is changed in the store but when I save the model the changes are gone. The team model has a members hasMany relationship and I. All of this happens in a modal dialog.


My code is something similar to this:



// editing in the itemController

.....
var members = this.get('model.members'),
currentMember = this.get('activeMember.content'),
isChecked = this.get('isChecked');

if (isChecked === true)
members.pushObject(currentMember);
else
members.removeObject(currentMember);
.....


-



// saving in the parentController

.....
this.store.find('team').then(function(team){
team.save();
}
.....




Aucun commentaire:

Enregistrer un commentaire