How to implement angular.js retry with exponential back-off?

How would I implement retry logic in angular.js with exponential back-off?

  1. Would the right place for the logic be in $httpProvider.requestInterceptors?
  2. Can I selectively pick to use it with some $http services and not others?

This is an old post, but here's my thoughts. I'd use a responseInterceptor. Since you can just return another promise, you can decide how to retry. You have access the the $http config in the interceptor, so you can add special configuration to determine what the back-off should be (or whether to apply the retry logic at all).