You have an Observable that fetches user data from an API. However, the API occasionally fails. You want to implement a mechanism that retries the API call up to 3 times before handling the error. How would you achieve this?

  • catch(error)
  • repeat(3)
  • retry(3)
  • retryWhen
To retry an observable up to a specified number of times, you can use the retry(3) operator. It retries the source observable up to 3 times before emitting an error if it still fails.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *