I would like to copy a complex object with EmberJS. This object contains arrays, other objects, data values, strings and other values. I see the Copy method is deprecated and there is an addon called ember-copy to replace it.
I tried to use the ember-copy addon but when I set the second argument to true (indicating that I want a deep copy) it says I cannot copy an object that does not implement Ember.Copyable. I transformed this object to an EmberObject, passing the Copyable mixing, but even with that it says I need to implement a Copy method. I do not understand why I would need the ember-copy addon if I need to implement it manually.
I believe cloning an object should be something a framework must be capable of doing. Every framework I used provided a way to do it with no effort, but it seems to be a hard thing to do with Ember.
Aucun commentaire:
Enregistrer un commentaire