I have the following JavaScript/Angular code:
var a = {};
var b = {};
a.ref = b;
b.ref = a;
angular.copy(a);
When angular.copy
fires, the browser locks up. I'm assuming this is because the copy function is doing a deep copy, and when it starts to copy a's reference of b, it goes into b and then wants to copy its reference of a, thus creating a circular copy, which will never end.
Is this assumption right? If so, is there a way to avoid this? I'm assuming the answer will involve changing the way my data looks, but I'm curious to hear another person's thoughts.