I have a javascript object graph that contains cyclical references. When I use this object in angular, firefox gives me the following error message (the "..." contains 100+ duplicates of the same line preceding and following it):
Error: too much recursion equals@http://localhost:8080/ops/bower_components/angular/angular.js:995:1
equals@http://localhost:8080/ops/bower_components/angular/angular.js:997:15
equals@http://localhost:8080/ops/bower_components/angular/angular.js:997:15
...
equals@http://localhost:8080/ops/bower_components/angular/angular.js:997:15
equals@http://localhost:8080/ops/bower_components/angular/angular.js:984:17
equals@http://localhost:8080/ops/bower_components/angular/angular.js:997:15
$RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost:8080/ops/bower_components/angular/angular.js:12491:1
$RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost:8080/ops/bower_components/angular/angular.js:12762:13
done@http://localhost:8080/ops/bower_components/angular/angular.js:8357:34
completeRequest@http://localhost:8080/ops/bower_components/angular/angular.js:8571:7
createHttpBackend/</xhr.onreadystatechange@http://localhost:8080/ops/bower_components/angular/angular.js:8514:1
Is there a way to tell angular to consider objects equal if they match X levels deep? Or does angular just not work with cyclical references?
The Backstory (in case you wanted to know)
I was having trouble finding a solution in jackson which would not serialize objects that have already appeared on a particular traversal path. This seems like it should be pretty straight forward to me, but I guess the functionality doesn't exist. That's when I stumbled upon jsog in this answer which enabled me to transfer my object graph (w/ circular dependencies) over to javascript. I was very happy that jsog did this for me, but then I encountered the above error.