Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Maximum call stack size exceeded when using object with circular references in ngClass #15373

Closed
Malczewski opened this issue Nov 7, 2016 · 1 comment

Comments

@Malczewski
Copy link

Using objects with circular references in ng-class causes "stack size exceeded" errors in console.
Reproduced in 1.5.0 - http://plnkr.co/edit/TwZphKvat6tzWrzwOrv6?p=preview
Related to #11372.

@gkalpak
Copy link
Member

gkalpak commented Nov 7, 2016

This will taken care of by #15246.

In the meantime, since you are only interested in the presence of the property and don't need a deep copy of it, you can convert it to boolean when using it inside ngClass (see below). This will also improve the performance.

// Replace that:
<div ng-class="{foo: $ctrl.someLargeObject}"></div>

// With this:
<div ng-class="{foo: !!$ctrl.someLargeObject}"></div>

@gkalpak gkalpak closed this as completed Nov 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants