html5-sortable-angularjs
html5-sortable-angularjs copied to clipboard
why using angular.copy
using angular.copy in handleDrop causes side effects hard to debug.
i had an array of objects, and elements were copyed to another array (lets call it helper array), sorting was based on this. after handleDrop, the object was replaced in helper array, but the original array kept the original object..
why you use angular.copy when creating the temp variable? what's the use case when it's needed?
Hi. angular.copy I think will equivalent with _.clone ( underscore ) https://underscorejs.org/#clone as explain below
Create a shallow-copied clone of the provided plain object. Any nested objects or arrays will be copied by reference, not duplicated.
The reason I want to use "copy" to prevent for sure the data is isolation when handle on array.