0
I need to call a Function after all get/post requests are completed. Note: I cannot call this function several 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);
        }
						
Or Voce can create a very simple Directive that just Listen through that event and calls the function you need. Ai Voce places this Directive in the header or footer.
– Denison Luz
if(-loadingCount === 0) $rootScope. $broadcast('loading:finalized'); passes more than once still.
– Max Ferreira
I understood very well its solution, I had already tried it and I went through the same problem, the fact of being async.
– Max Ferreira
@Maxferreira If all the requirements are part of the same Service Voce could use Promises ($q). I answered a similar question here http://stackoverflow.com/a/18674913/1310945
– Denison Luz