angular-http-client

Installation
SKILL.md

HTTP Client

Priority: P1 (HIGH)

Principles

  • Functional Interceptors: Use HttpInterceptorFn (e.g., (req, next) => next(req.clone({ setHeaders: { Authorization: token } }))). Clone requests with req.clone(class-based interceptors deprecated. Register via withInterceptors([...]) in provideHttpClient.
  • Typed Responses: Always type http.post<T>(), http.get<T>(). Use inject(HttpClient) in services (not constructor injection). Add provideHttpClient(withInterceptors([...]), withFetch()) to app.config.ts.
  • Services: Encapsulate all HTTP calls in Services. Never call http in Components.

Signal-Based HTTP (Angular 17+)

Prefer httpResource() over manual subscribe for reactive data loading — it auto-refetches when its signal inputs change:

// Reactive: refetches automatically when userId() changes
userResource = httpResource<User>(() => `/api/users/${this.userId()}`);
// States: .isLoading() | .hasValue() | .error() | .value() | .reload()
Installs
1
GitHub Stars
521
First Seen
Jun 18, 2026
angular-http-client — hoangnguyen0403/agent-skills-standard