thrag thrag - 1 year ago 227
AngularJS Question

RangeError: Maximum call stack size exceeded

I guess this means there is a circular reference somehwere but for the life of me I can't guess how to fix it.

Anyone have any ideas?

Check the debug console in Chrome (for example) and you'll see the error.
The offending line is = map; is being "$watched" on the controller via

$scope.$watch("", function (map) { ... }, true);

Answer Source

It's because you're comparing for object for equality rather than for reference. Change your $watch statement to this:

$scope.$watch("", function (map) {
    if (map === undefined) {
        alert("map has no value");
    } else {
        alert("map is defined");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download