This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Error using ngOptions with objects containing circular references #11372
Closed
Description
The new ngOptions
in Angular 1.4-beta
doesn't handle objects containing circular references well.
Steps to reproduce:
- Define a
ng-options
withng-model
. At least one of the items in the source array must be a recursive object (such as a Breeze entity). - Select the recursive object.
- Uncaught RangeError: Maximum call stack size exceeded is printed on the console.
http://jsfiddle.net/dubejf/tn102eh8/ (using 1.4.0-beta6
)
The watcher of ngModel
, set by the ngOptionsDirective
, compares the selected item with the last value by deep equality (using angular.equals
). When a recursive object is selected, this causes the stack to blow up (as described in #7724).
Using track by
doesn't alleviate the problem.
This error is not reproducible in Angular 1.3.