angular.copy loses own non-enumerable properties #15692
Description
Do you want to request a feature or report a bug?
Report a bug.
What is the current behavior?
angular.copy uses as destination object created from prototype, which it then populates with own object properties.
This way it loses own not enumerable properties which can cause bugs.
Demo : https://jsfiddle.net/zuzusik/7ye3m006/
What is the expected behavior?
Angular doesn't lose non-enumerable properties. I assume this can be achieved by iterating through Object.getOwnPropertyNames
instead of using for (key in source)
loop and checking for hasOwnProperty
.
What is the motivation / use case for changing the behavior?
This causes bug with JSData v3: https://jsfiddle.net/zuzusik/6evanz3g/
Details: js-data/js-data#442
Which versions of AngularJS
Angular 1.6.2, any browser.