mardi 31 mars 2015

Ember js cloning record with relations

What I try to achieve: user goes to post/3/edit. Here the form is bound to the model, so it already filled out. And on the top



You are editing the post {{model.title}}


If the user changes the title it changes dynamic. I don't want this behavior. I want to apply the changes to the record, if user already hit the "Save" button (and everything went right on server side).


my idea:



  1. clone the record

  2. bind cloned record to the form

  3. after hit "Save" the properties of the cloned (and edited) record are applied to the original record.


Questions



  • Is this the right way to do this?

  • Is there something like record.clone(), which deep copy the record with it's relations?

  • Is there a way to apply the changes, like originalRecord.apply(clonedRecord)?





Aucun commentaire:

Enregistrer un commentaire