Problem with config [UPDATE]


#1

I have the following function that each time a call is run http, show one diff with loader gif. The problem I have is that I need to update the information from time to time I receive that call. But it is very uncomfortable and impractical that every so often seeing themselves this gif. It’s not comfortable for me or for the user. How I can fix this? Anyone have any idea?

.config(function ($httpProvider) {
    $httpProvider.responseInterceptors.push('myHttpInterceptor');
    var spinnerFunction = function (data, headersGetter) {
        // todo start the spinner here
        //alert('start spinner');
        $('#mydiv').show();
        return data;
    };
    $httpProvider.defaults.transformRequest.push(spinnerFunction);
})
// register the interceptor as a service, intercepts ALL angular ajax http calls
.factory('myHttpInterceptor', function ($q, $window) {
    return function (promise) {
        return promise.then(function (response) {
            // do something on success
            // todo hide the spinner
            //alert('stop spinner');
            $('#mydiv').hide();
            return response;

        }, function (response) {
            // do something on error
            // todo hide the spinner
            //alert('stop spinner');
            $('#mydiv').hide();
            return $q.reject(response);
        });
    };
})

#2

Upload, I changed the problem