HTTP Interceptors
Introduction
Section titled “Introduction”Interceptors sit between your app and the server, inspecting/modifying requests and responses.
Common Uses
Section titled “Common Uses”- Adding auth tokens
- Error handling
- Request/response logging
- Loading indicators
- Caching
Example
Section titled “Example”export const authInterceptor: HttpInterceptorFn = (req, next) => { const token = inject(AuthService).getToken(); const cloned = token ? req.clone({ setHeaders: { Authorization: `Bearer ${token}` } }) : req; return next(cloned);};Summary
Section titled “Summary”Interceptors provide centralized HTTP request/response processing.”