How to create a duplicate of an object (obj.dup)


How do I create a duplicate of an object?

obj1 = Ember.Object.create({name: "Sample"});
obj2 = obj1;
obj2.set('name', 'different');
obj1.get('name');  // different

Any method similar to obj2 = obj1.dup ?

Duplicate an object of an Ember Data model

Look into


Yeah, saw that but din understand how to use the mix on an ember object. Could you give an example please?


use this

copy(object, true); // 2nd argument deep copying.