This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
md-chips causes stack overflow when data objects have circular references #5778
Labels
P1: urgent
Urgent issues that should be addressed in the next minor or patch release.
Milestone
The
<md-chips>
and<md-contact-chips>
directives can cause a stack overflow when the data objects have a circular reference. This worked up until RC2 when this fix(md-chips): appendChip disallows identical objects #4479 changedMdChipsCtrl.prototype.appendChip
by adding a call toangular.equals()
which doesn't support circular references. Here is a codepen (http://codepen.io/rich-j/pen/RWvymm?editors=101) that shows the issue. Try adding another "person" to the contact chips.Angular's
equals()
function has several unimplemented requests for circular reference support:Each "person" in our system is a single object that has references to related objects (e.g. parent/child, owner/member). We would like to pass these "person" instances directly to
<md-contact-chips>
. The Angularequals()
function does work for object equality (i.e. same object references) however for unequal objects it can get stuck in a cycle since it unfortunately implements a depth first search on object properties.The text was updated successfully, but these errors were encountered: