← Angular learning pathAngular · Module 8 of 10
HTTP and RxJS
Call APIs with HttpClient and handle streams with RxJS Observables.
📖 Key ideas
- provideHttpClient() enables HttpClient.
- http.get<User[]>("/api/users") returns an Observable.
- Subscribe or use the async pipe: users$ | async.
- RxJS operators: map, filter, switchMap, catchError.
- Interceptors add auth headers or handle errors for all requests.
💡 Real-life example: An Observable is a YouTube subscription: new videos (values) arrive over time until you unsubscribe.
HttpClientAngular service for HTTP
ObservableStream of values over time
async pipeSubscribes in the template automatically
InterceptorCode that runs for every request