Angular - HTTP ClientWhy is it important that Angular HTTP interceptors return an Observable instead of a Promise?ABecause Angular HTTPClient uses Observables for request streams and cancellationBBecause Promises are not supported in AngularCBecause Observables automatically retry failed requestsDBecause Promises cannot carry headersCheck Answer
Step-by-Step SolutionSolution:Step 1: Recall Angular HTTPClient designAngular HTTPClient uses Observables to support streams, multiple events, and cancellation.Step 2: Understand why Observables are required in interceptorsInterceptors must return Observable to integrate with HTTPClient's reactive flow.Final Answer:Because Angular HTTPClient uses Observables for request streams and cancellation -> Option AQuick Check:HTTPClient uses Observables, not Promises [OK]Quick Trick: Angular HTTPClient is built on Observables, not Promises [OK]Common Mistakes:MISTAKESThinking Promises are unsupportedAssuming Observables auto-retry requestsConfusing headers with async types
Master "HTTP Client" in Angular9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Angular Quizzes Angular Change Detection - Triggering detection manually - Quiz 9hard Angular Change Detection - Performance impact of change detection - Quiz 7medium HTTP Client - HttpClientModule setup - Quiz 6medium HTTP Client - Setting headers and params - Quiz 13medium HTTP Client - POST requests - Quiz 13medium Reactive Forms - Form state tracking (dirty, touched, valid) - Quiz 9hard RxJS and Observables Fundamentals - Subject types (Subject, BehaviorSubject, ReplaySubject) - Quiz 11easy Services and Dependency Injection - Singleton service behavior - Quiz 2easy Template-Driven Forms - FormsModule setup - Quiz 1easy Template-Driven Forms - Two-way binding in forms - Quiz 10hard