← Back to Web app developers
See how it helps
1. Typed
2. Interceptors and
Angular HTTP integration
Builds typed HTTP services with predictable parameters, interceptors, cancellation and actionable error states.
angular-http
Team members using this skill
When is it useful?
Use when Angular screens exchange data with an API and need consistent failure or retry behavior.
What does it help you do?
- Separates transport data from screen models and encodes query parameters safely.
- Uses immutable request changes and per-request interceptor context.
- Distinguishes authentication, validation and network errors without blindly retrying writes.
Try asking this
Implement order search and saving with typed services, cancelled obsolete searches and field-level handling of rejected saves. Type two search terms quickly, then save with an invalid postcode. Only the latest results should appear, and the postcode error must preserve other edits.
Detailed documentation
Read the skill’s original instructions, examples and checks in their authored language.
Show less
HTTP & Backend Integration
Keep HTTP communication in typed Angular services and interceptors with clear request lifecycles, error normalization and zero leaked server secrets.
1. Typed HttpClient services and parameters
- Encapsulate API calls in dedicated domain/data services rather than calling
HttpClientdirectly inside components. - Type every request and response (
this.http.get<OrderSummaryDto>(...)) and map transport DTOs into domain models where the API shape differs from UI needs. - Build query strings with
HttpParams(new HttpParams({ fromObject: ... })) or theparamsoption object rather than manual string concatenation so special characters are properly URL-encoded. - Never embed server-side API keys or secrets in Angular environment files or client bundles.
2. Interceptors and HttpContext
- Match the project's interceptor registration (
withInterceptors([fn])inprovideHttpClientvsHTTP_INTERCEPTORSclass providers). - Remember
HttpRequestandHttpHeadersare immutable: always pass the result ofreq.clone({ setHeaders: ... })tonext(clonedReq). - Use
HttpContextandHttpContextToken<T>to pass per-request metadata (such as skipping auth headers, suppressing global error toasts, or tagging cache policy) to interceptors cleanly without polluting URLs or headers.
3. Error handling, retries and cancellation
- Normalize
HttpErrorResponse(status0network/CORS failure,401/403auth,422validation errors,5xxserver failures) so components receive actionable error states. - Apply
retry({ count, delay })only to idempotent reads (GET) or transient network errors, never blindly to non-idempotentPOST/PATCHmutations. - Understand that unsubscribing from
HttpClientaborts the in-flight XHR/fetchrequest; useswitchMapfor reads/searches andexhaustMaporconcatMapfor mutations.
Before you finish
- All
HttpClientcalls live in typed services and useHttpParamsfor query parameters. - Interceptors clone requests immutably and use
HttpContextTokenfor per-request flags. -
HttpErrorResponsestatuses (0,401/403,422,5xx) and cancellation are handled predictably.
Included files 2
LICENSE.txtSKILL.md
