vendredi 30 janvier 2015

Ember Save a change to an attribute

Very new to Ember, quick question please: How do I save/persist a change to an attribute? Have the following action in the controller:



actions: {

togOnField: function(){

if (this.get('onField')){
this.set('onField', false);
} else {
this.set('onField', true);
}
}

}


Looking around I've found



this.get('model').save


At the moment, using this, the attribute is immediately reverting back to its previous state. Does this mean the save is unsuccessful? Working with a Sails API and Postgres DB, both seem to be working fine.


And what are the different options for how I might save from this action? Thanks a lot.





Aucun commentaire:

Enregistrer un commentaire