我已通过注入$ http来覆盖$ exceptionHandler。我这样做是因为我记录了一个arror到服务器。
Module.factory('$exceptionHandler', ['$http', function ($http) {
"use strict";
//code
}
但是我也有一个拦截器来添加我的$ httpProvider:
Module.config(['$httpProvider', function($httpProvider) {
$httpProvider.interceptors.push('special-http');
}]);
这是拦截器(我包裹在一个工厂):
EDIT_ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ ____
固定的 '$ HTTP'
的名字后,我现在得到这个错误:
Uncaught Error: [$injector:cdep] Circular dependency found: $http <- $exceptionHandler <- $rootScope
http://errors.angularjs.org/1.2.1/$injector/cdep?p0=%24http%20%3C-%20%24exceptionHandler%20%3C-%20%24rootScope
这可能是一个愚蠢的事情,但是是不是有空间字符串“$ HTTP”在工厂的定义? – Wawy
@Wawy如果是我要脸红.. – FutuToad
@Wawy谢谢,你可以看看我的编辑关于**循环依赖** – FutuToad