thrag thrag - 9 months ago 113
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);


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");