I want to show the counter when I first load my application, for example: https://devart.withgoogle.com/
I tried to do this through the Services module as follows:
angular.module('InitialLoad', []) .config(function ($httpProvider) { $httpProvider.responseInterceptors.push('myHttpInterceptor'); var spinnerFunction = function (data, headersGetter) { $('#loading').fadeIn(); return data; }; $httpProvider.defaults.transformRequest.push(spinnerFunction); }) .factory('myHttpInterceptor', function ($q, $window) { return function (promise) { return promise.then(function (response) { $('#loading').fadeOut(function(){ $(this).remove(); }); return response; }, function (response) { $('#loading').fadeOut(function(){ $(this).remove(); }); return $q.reject(response); }); }; });
But there is something wrong with this: the first one is that it does not listen to the first download, which it listens to EVERY request. It also doesn't show or hide the download as gracefully as it did on DevArt, and I use jQuery to hide and show the bootloader, instead of using Angular Animation.
Can anyone help? To clarify this, download the INITIAL! And not to show the counter on subsequent requests. I use this for this: https://github.com/chieffancypants/angular-loading-bar , but I want to show a splash to launch the application, which is different.
source share