【发布时间】:2015-11-18 13:01:57
【问题描述】:
我想发布发生在 Angular 应用程序中的错误。
我遵循related question 中给出的方法,正如答案中所建议的,我注入了 $injector,然后从那里获得了 $http 服务。 但是这条线
未捕获的错误:循环依赖:$http
继续来。
here is the fiddle with the problem
附上相关代码:
var mod = angular.module('test', []);
mod.config(function ($provide) {
$provide.decorator("$exceptionHandler", ['$delegate', '$injector', function ($delegate, $injector) {
var $http = $injector.get("$http");
}]);
});
mod.controller('testCtrl', function ($scope) {
});
如果您评论该行
var $http = $injector.get("$http");
循环依赖错误消失了。
我认为我的理解中遗漏了一些东西。我究竟做错了什么?毕竟,这似乎对其他人有用。
也欢迎任何关于如何实现“将错误发布到服务”的初始目标的建议。
谢谢大家
【问题讨论】:
标签: angularjs