2013-11-04 203 views
2

Javascript代码...

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); 
       } 
     }; 
}); 

我认为,该消息应该在XHR请求开始被记录。 但我看到没有xhr请求的日志。

Chrome Dev Tools Screenshot

我误解的API?

+0

Plunkr显示问题http://plnkr.co/edit/Ny3jo9?p=preview –

回答