Stoppen Sie die Anforderung im anglejs-Interceptor

Wie kann ich eine Anfrage in Angularjs Interceptor stoppen?

Gibt es eine Möglichkeit, das zu tun?

Ich habe versucht, Versprechen zu verwenden und Ablehnung statt Entschlossenheit zu senden!

.factory('connectionInterceptor', ['$q', '$timeout',
   function($q, $timeout) {
    var connectionInterceptor = {
        request: function(config) {
            var q = $q.defer();
            $timeout(function() {
                q.reject();
            }, 2000)
            return q.promise;
            // return config;
        }
    }
    return connectionInterceptor;
  }
])
.config(function($httpProvider) {
   $httpProvider.interceptors.push('connectionInterceptor');
});

Antworten auf die Frage(4)

Ihre Antwort auf die Frage