Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs “未捕获异常”;无法读取属性';信息';“未定义”的定义;安格拉斯_Angularjs_Logging - Fatal编程技术网

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:重新启动使用“吞咽服务”后,它工作了……日志正在打印……谢谢