Angular js - detect when all $http() have finished
Ok i have tons of $http() calls all around the app code, i'm wondering is there any way / best practice to detect when all $http() around the app have finished ( success/error donesn't matter what they return, just need to know if finished )? So that i can show a loading gif until they are loading ? thanks Do it like this: angular.module('app').factory('httpInterceptor', ['$q', '$rootScope', function ($q, $rootScope) { var loadingCount = 0; return { request: function (config) { if(++loadingCount === 1) $rootScope.$broadcast('loading:progress'); return config || $q.when(config); }, response: