任何人都知道如何在AnngularJs中获取拦截器内的路径
基本上我需要做一个条件来避免几个Api请求的动画。
这是我的代码
var CRMSWebPortal = angular.module('CRMSWebPortal', ['ngFileUpload', 'ngSanitize', 'ui.bootstrap']);
CRMSWebPortal.factory('httpPreConfig', ['$http', '$rootScope', function ($http, $rootScope) {
$http.defaults.transformRequest.push(function (data) {
//------I need path for all external api calls here???
$rootScope.$broadcast('httpCallStarted');
return data;
});
$http.defaults.transformResponse.push(function (data) {
$rootScope.$broadcast('httpCallStopped');
return data;
});
return $http;
}]);
CRMSWebPortal.run(['$rootScope', 'httpPreConfig', function ($rootScope, httpPreConfig) {
$rootScope.$on("httpCallStarted", function () {
$.blockUI({
message: '<p><img class="loading"> Just a moment...</p>',
});
});
$rootScope.$on("httpCallStopped", function () {
$.unblockUI();
});
}]);