Skip to content
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.

ng-options with track by and circular reference in objects -> Maximum call stack size exceeded #13378

Open
@rasmusvhansen

Description

@rasmusvhansen

Observed in 1.4.8, but looking at the code, it seems to be an issue in 1.5 as well.

Reproduced here: http://jsfiddle.net/tn102eh8/2/ (1.4.8)
And here: http://jsfiddle.net/tn102eh8/3/ (1.5.0-beta2)
Related to #11372

The issue seems to be that ng-options runs equals(previousValue, nextValue) if trackby is used
https://github.com/angular/angular.js/blob/master/src/ng/directive/ngOptions.js#L737

I think it should do

if (ngOptions.trackBy) {
    var prev = ngOptions.getTrackByValue(previousValue, ngOptions.trackBy);
    var next = ngOptions.getTrackByValue(nextValue, ngOptions.trackBy)
}

And then use angular.equals(prev, next) instead.
I don't have an env. for angular development at the moment, but if you agree that this is an issue, I guess I can set it up and do a PR.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions