I need to call a function after all get / post requests are complete. Note: I can not call this function multiple times!
angular
.module('app.services')
.config(InterceptorConfig)
.service('InterceptorService', InterceptorService);
function InterceptorConfig($httpProvider) {
$httpProvider.interceptors.push('InterceptorService');
}
InterceptorService.$inject = ['$q', '$rootScope', 'Constants'];
function InterceptorService($q, $rootScope, Constants) {
return {
request: function(config) {
##########################
NÃO POSSO CHAMAR AQUI
##########################
if (config.method === 'POST' && !config.file) {
config.headers["Content-Type"] = "application/json";
}
if (!config.notloader) {
$rootScope.$broadcast("loader_show");
}
return config || $q.when(config);
}