AngularJS intercept all $http requests

前端 未结 2 1271
感情败类
感情败类 2021-01-01 17:44

I can\'t seem to get the $httpProvider.interceptors to actually intercept. I created a sample on JSFiddle that logs when the interceptor is run and when the $http response i

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-01 18:43

    The request interceptor isn't running after the data is returned. It's running before. Your logIt function inserts the newest message at the top. If you change your code to use the $log service, you'll see that the interceptor runs first.

提交回复
热议问题