如何查找 Angular.js 中已经在进行中的哪一行代码触发器$digest

How to find the which line of code triggers $digest already in progress in Angular.js

本文关键字:一行 代码 触发器 进行中 digest 查找 何查找 Angular js      更新时间:2023-09-26

我有一个 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

您有两个选择。 二叉搜索,即将应用程序切成两半并检查错误何时停止。 然后专注于此。

或者进入角度源并在报告的行中放置断点。然后使用调用堆栈进行回溯。

这两个选项最终都可能很耗时,但我将从调用堆栈开始。祝你好运。