Angularjs “未捕获异常”;无法读取属性';信息';“未定义”的定义;安格拉斯
我试图在我的主配置文件中添加一个拦截器,下面是代码。但是在添加日志后,我得到了上面的错误。谷歌搜索,但没有得到太多帮助。如果有人以前遇到过这个错误,请帮助Angularjs “未捕获异常”;无法读取属性';信息';“未定义”的定义;安格拉斯,angularjs,logging,Angularjs,Logging,我试图在我的主配置文件中添加一个拦截器,下面是代码。但是在添加日志后,我得到了上面的错误。谷歌搜索,但没有得到太多帮助。如果有人以前遇到过这个错误,请帮助 // Intercept http calls. $provide.factory('HttpResponseInterceptor', ['$q', '$log', function ($q, $log) { return { // On request success request: funct
// Intercept http calls.
$provide.factory('HttpResponseInterceptor', ['$q', '$log', function ($q, $log) {
return {
// On request success
request: function (config) {
$log.info('HttpInterceptor Request object' + config); // Contains the data about the request before it is sent.
// Return the config or wrap it in a promise if blank.
return config || $q.when(config);
},
// On request failure
requestError: function (rejection) {
$log.error('HttpInterceptor Request Failure' + rejection); // Contains the data about the error on the request.
// Return the promise rejection.
return $q.reject(rejection);
},
// On response success
response: function (response) {
$log.info('HttpInterceptor Success Response' + response); // Contains the data from the response.
// Return the response or promise.
return response || $q.when(response);
},
// On response failture
responseError: function (rejection) {
$log.error('HttpInterceptor Response Failure' + rejection); // Contains the data about the error.
// Return the promise rejection.
return $q.reject(rejection);
}
};
}]);
$httpProvider.interceptors.push('HttpResponseInterceptor');
添加一个插入器以便我们进行诊断。@Jones:重新启动使用“吞咽服务”后,它工作了……日志正在打印……谢谢添加一个插入器以便我们进行诊断。@Jones:重新启动使用“吞咽服务”后,它工作了……日志正在打印……谢谢