我有一个在浏览器控制台中报告错误的 Angular.js 应用程序:
Error: [$rootScope:inprog] $digest already in progress
你能告诉我如何找到触发此错误的代码吗?
更新:
这是我的堆栈跟踪:
Error: [$rootScope:inprog] $digest already in progress
http://errors.angularjs.org/1.2.0-rc.3/$rootScope/inprog?p0=%24digest
at http://localhost:3000/js/libs/angular.js/angular.js:78:12
at beginPhase (http://localhost:3000/js/libs/angular.js/angular.js:10995:15)
at Scope.$apply (http://localhost:3000/js/libs/angular.js/angular.js:10795:11)
at HTMLInputElement.<anonymous> (http://localhost:3000/js/libs/angular.js/angular.js:16514:17)
at http://localhost:3000/js/libs/angular.js/angular.js:2331:10
at Array.forEach (native)
at forEach (http://localhost:3000/js/libs/angular.js/angular.js:213:11)
at HTMLInputElement.eventHandler (http://localhost:3000/js/libs/angular.js/angular.js:2330:5)
at scroll (http://localhost:3000/js/libs/angular.js/angular.js:3479:26)
at http://localhost:3000/js/libs/angular.js/angular-route.js:852:15 angular.js:8296
最佳答案
您有两个选择。二进制搜索,即将应用程序切成两半并检查错误何时停止。然后专注于此。
或者进入 Angular 源并在报告的行中放置一个断点。然后使用调用堆栈进行回溯。
这两种选择最终都可能很耗时,但我会从调用堆栈开始。祝你好运。
关于javascript - 如何在 Angular.js 中找到哪一行代码触发了 $digest 已经在进行中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19505944/