0
リクエストと応答を記録するための単純なhttpインターセプタを作成しました。問題は、最初に実行されるconfigブロックでは未定義であり、どのモジュールがインスタンス化できなかったかによってエラーをスローします。以下は使用されるコードです:角度:httpインターセプタが設定ブロックに注入されていません
authApp
.factory("httpInterceptor",function($log){
var httpInterceptor = {};
httpInterceptor.request = function(config){
$log.info("request is being made to " + config.url);
return config;
};
httpInterceptor.response = function(config){
$log.info("request to URL : " + config.url + " is completed
now.");
return config;
};
return httpInterceptor;
})
.config(function($httpProvider){
// Http Interceptor
$httpProvider.interceptors.push(httpInterceptor);
});
ありがとうございます!
ありがとうございました...全体的な流れが同様に今も理にかなっています! –