3

Javascript code...

commonApp = angular.module('commonApp') 
.config(function($httpProvider){
        $httpProvider.interceptors.push('myHttpInterceptor');
})
.factory('myHttpInterceptor', function($q, $window){
        return {
               request: function(config){
                       console.log('Request started'); // LOG AT REQUEST START
                       return config || $q.when(config);
                }
        };
 });

I believe that the message should be logged at the beginning of an xhr request. But I am seeing logs without xhr requests.

Chrome Dev Tools Screenshot

Am I misunderstanding the api?

Mr Hyde
  • 3,393
  • 8
  • 36
  • 48

1 Answers1

4

Your plunkr seems to be working fine? There's a good blog post on understanding angular http interceptors you might find useful: http://djds4rce.wordpress.com/2013/08/13/understanding-angular-http-interceptors/

Jan Molak
  • 4,426
  • 2
  • 36
  • 32