dimanche 29 mars 2015

Ember: this.get from controller returns old data not the current data that is bound in a input

JsBin http://ift.tt/1G4z4Vf


I am having an issue where a value that is bound to input fields is not read in the same as it is currently set in the text fields.


I have a component I want to use as a modular edit all over my application. The only thing this component needs passed in is what ever the current business is. From there all the logic for the form is handled within the component, including passing it to the server.


I am trying to have a feature where the (save/reset) buttons only appear when the user has modified the business. When you pass in the currentBusiness all the fields are properly populated but if you edit one field then press Save, then from the save Action I do, this.get('currentBusiness.data') to get the updated fields and pass it as the data field of my ajax call. But this.get('currentBusiness.data') returns the values that were initially passed into the component and not the updated fields from the text boxes.


However currentBusinessO which observes all the editable fields triggers when ever a field is edited and that is also using this.get('currentBusiness')


Unfortunately Ember is the first framework I have used and it has quite the learning curve.


Ember: v1.9.0-beta.3


Ember-data: v1.0.0-beta.11


Open jsbin, click Set, edit one field, press save. I dump the contents of currentBusiness to console and it doesnt match the edited fields.


Thanks for the help.





Aucun commentaire:

Enregistrer un commentaire