Javascript pirate’s lounge: Deep clone in AngularJS

TL;DR

angular.copy from AngularJS 1.x is quadratic-slow on large objects, especially in IE.

Use JSON.stringify/JSON.parse for simple objects or _.deepClone for objects with Date objects or cyclic references. Actually, if you don’t clone objects of more than 1000 nodes, this shouldn’t bother you.

How I bumped into it

The other day I faced with a need to deeply clone an object from the redux store and since we’re using angular I initially thought about angular.copy, but then I…

Read the entire article at the source link…

We're happy to share this resource that we found. The content displayed on this page is property of it's original author and/or their organization.

Leave a Reply