I am running into an issue where I want to pass around an array and then clone all its attributes and ensure that nothing is bound to it.
But it doesn’t seem to be obvious. And I am trying to find a relevant code example that demonstrates the use of Ember.Copyable mixin.
App.MyComponent = Ember.Component.extend({
collection: Ember.A([]),
actions: {
shareCollection: function() {
var boundCollection = this.get('collection');
// how do I unbind and make a copy of boundCollection array regardless of what is inside it?
var unboundCollection; // should be a deep copy of the bound collection object
this.sendAction('share', unboundCollection);
},
}
});
Looking for a generic example of the use of Ember.copy(array, deep=true);
Perhaps a functional JSBin example?
This seems like it should be obvious but not really finding useful documentation or examples.