Saturday, February 16, 2019

Deep copying objects in Angular



AngularJS has angular.copy() to deep copy objects and arrays.




Does Angular also have something like that?


Answer



You can also use:



JSON.parse(JSON.stringify(Object))



if it's on your scope, it's in every Angular component, directive, etc. and it's also on every node environment.



Unless you have a circular reference, it should work and will effectively dissociate your variable reference to the original object.


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...