How to implement angular.js repetition with exponential indent?
2 answers
This is an old post, but here are my thoughts. I would use responseInterceptor
. Since you can simply return another promise, you can decide how to try again. You have access to $ http config
in the interceptor, so you can add custom configuration to determine what should be indented (or whether to apply retry logic at all).
+2
source to share
For upcoming people: using some pre-available components and module looks more Angular. So you can try one of these backo2 or angular-backoff
Every link is used here. However, don't use setTimeout the wrong way Angular and you should use $ interval or $ timeout.
+1
source to share