0
私のangularjsプロジェクトで401ステータスコードを処理できるようにしたいと思います。私はレスポンスインターセプタのいくつかの異なるバリエーションを試みましたが、それらのすべてが-1のコードを返します。私はなぜこれが起こっているのか理解したいと思います。 Angularjs v1.5.8を使用しています。AngularjsのresponseErrorインターセプタが-1のステータスコードを返す理由
myApp.factory('httpResponseInterceptor', function() {
return {
responseError: function (config) {
console.log(config.status);
//The above prints out -1 to the console
return config;
}
};
});
myApp.config(function ($httpProvider) {
$httpProvider.interceptors.push('httpResponseInterceptor');
});