0

I have a page where lots of API calls is projected . I need to cancel all the API calls when I click a button.

I know that we can pass timeout and achieve this. But for this I need to add timeout attribute by assiging $q.defer() for all my api calls. So I thought of doing this using httpinterceptor area.

But I can't pass a $q.defer() to an interceptor from my controller. Since $scope is not accessible in the httpinterceptor.

Help me to share the $q.defer() between controller and httpinterceptor, so that I could reject the $q.defer() in the button's click event.

Mehran Hatami
  • 12,723
  • 6
  • 28
  • 35

0 Answers0