Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

angular.copy loses own non-enumerable properties #15692

Closed
@zuzusik

Description

@zuzusik

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions