Tempo limite angular de 1,5 usando um HttpInterceptor

Tudo,

Estou tentando configurar um httpInterceptor global para ter uma mensagem pop-up personalizada quando um tempo limite do cliente aparecer, não um servidor. Encontrei este artigo:Angular $ http: definindo uma promessa na configuração 'timeout' , e o converteu em um httpInterceptor, mas não funciona conforme o esperado e tem um comportamento estranho.

 $provide.factory('timeoutHttpInterceptor', function ($q, $translate, $injector) {

        var timeout = $q.defer();

        var timedOut = false;

        setTimeout(function () {
            timedOut = true;
            timeout.resolve();
        }, 10000);
        return {
            request: function (config) {
                config.timeout = timeout.promise;
                return config;
            },
            response: function(response) {
                return response;
            },
            responseError: function (config) {
                if(timedOut) {
                    var toastr = $injector.get('toastr');
                    toastr.custom('network', $translate('title'), $translate('label'), { timeOut: 5000000000000, closeButton: true, closeHtml: '<button></button>' });
                    return $q.reject({
                        error: 'timeout',
                        message: 'Request took longer than 1 second(s).'
                    });
                }
            },
        };
    });

questionAnswers(1)

yourAnswerToTheQuestion