This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Angular.copy support for ES6 Map (and other ES6 types?) #16067
Comments
There's an open (but stale) PR regarding this: |
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Jan 14, 2019
Closes angular#5085 Closes angular#13193 Closes angular#14352 Closes angular#15904 Closes angular#16055 Closes angular#16061 Closes angular#16067
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Jan 14, 2019
Closes angular#5085 Closes angular#13193 Closes angular#14352 Closes angular#15904 Closes angular#16055 Closes angular#16061 Closes angular#16067
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Jan 14, 2019
Closes angular#5085 Closes angular#13193 Closes angular#14352 Closes angular#15904 Closes angular#16055 Closes angular#16061 Closes angular#16067
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Jan 21, 2019
Closes angular#5085 Closes angular#13193 Closes angular#14352 Closes angular#15904 Closes angular#16055 Closes angular#16061 Closes angular#16067
Adding a list of unsupported types doesn't change this feature request. I'm still requesting that copy supports Map/other ES6 types rather than not supporting them. |
... unless this is saying 'won't fix this' separate from the fact that it's been commented that they're not supported? Otherwise, can we have this reopened? or should I copy/paste the description into a new request? |
I'd guess it's due to the fact that AngularJS is currently in LTS that features like this aren't getting added. |
@phasmal - indeed @frederikprijck is correct. We are now well into the LTS period and we are not adding new features to AngularJS. |
Ahh, great, thanks for the clarification - that makes much more sense! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm submitting a ...
Current behavior:
angular.copy
when called on an object containing an ES6 Map object fails to copy the Map contents. This is surprising for the developer-user since they would expect the new object to contain all the attributes of the old one, including contents (angular.copy
advertises as a deep copy)Expected / new behavior:
Addition of ES6 Map copy would mean
angular.copy
behaves as expected regardless of the presence of a Map in an object.I haven't looked at other ES6 types, but I would expect
angular.copy
should sensibly copy them as well, if it doesn't already.Minimal reproduction of the problem with instructions:
Angular version: 1.x.y
1.6.4-local+sha.617b36117
looking at latest code, it is iterating keys, which won't work for maps:
https://github.com/angular/angular.js/blob/master/src/Angular.js#L902
Browser: [all | Chrome XX | Firefox XX | Edge XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
Chrome 59.0.3071.86 (Official Build) (64-bit)
Tried replicating on Firefox, but was an older version of angular and caused error:
Looking at code, though it wouldn't work for Map on any browser that doesn't allow key iteration over map values (every browser I suspect).
For example, on FF:
Anything else:
This overlaps with the following issue:
#10304
However, that issue is talking about general 'iterable' object support (of which ES6 collections are a sub-set) which is a more intractable problem. This is focused specifically on ES6 collections.
Suggest treating Map similar to Array as a special case and using the built-in iteration features to populate the copy.
Alternately, define a global javascript 'clone' standard that objects can declare support for and make angular.copy redundant ;)
The text was updated successfully, but these errors were encountered: