Bird
0
0

You want to retry an HTTP request up to 3 times before handling the error. Which RxJS operator combination correctly implements this in Angular?

hard🚀 Application Q8 of 15
Angular - HTTP Client
You want to retry an HTTP request up to 3 times before handling the error. Which RxJS operator combination correctly implements this in Angular?
Apipe(retry(3), catchError(handleError))
Bpipe(catchError(handleError), retry(3))
Cpipe(retryWhen(handleError), catchError())
Dpipe(catchError(), retryWhen(handleError))
Step-by-Step Solution
Solution:
  1. Step 1: Understand retry and catchError order

    The retry operator should come before catchError to retry before error handling.
  2. Step 2: Confirm correct operator usage

    Using pipe(retry(3), catchError(handleError)) retries 3 times then calls error handler.
  3. Final Answer:

    pipe(retry(3), catchError(handleError)) -> Option A
  4. Quick Check:

    retry before catchError to retry requests [OK]
Quick Trick: Place retry before catchError to retry HTTP calls [OK]
Common Mistakes:
MISTAKES
  • Placing catchError before retry
  • Using retryWhen incorrectly
  • Not chaining operators in pipe

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes