引发RangeError:最大调用堆栈大小超过 [英] RangeError: Maximum call stack size exceeded
本文介绍了引发RangeError:最大调用堆栈大小超过的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想这意味着有一个循环引用somehwere但对我的生活我无法猜测如何解决它。
I guess this means there is a circular reference somehwere but for the life of me I can't guess how to fix it.
任何人有什么想法?
http://plnkr.co/edit/aNcBcU?p=$p$pview
检查浏览器的调试控制台(例如),你会看到错误。
违规行
Check the debug console in Chrome (for example) and you'll see the error. The offending line is
scope.map = map;
scope.map通过 $范围。$表(options.map功能(图){...}
是$注视控制器
推荐答案
这是因为你的比较对象的平等,而不是供参考。更改 $观看
声明如下:
It's because you're comparing for object for equality rather than for reference. Change your $watch
statement to this:
$scope.$watch("options.map", function (map) {
if (map === undefined) {
alert("map has no value");
} else {
alert("map is defined");
}
});
这篇关于引发RangeError:最大调用堆栈大小超过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文