angular-http

Implement HTTP data fetching in Angular using httpResource, resource, and HttpClient.

Updated Jun 28, 2026
One-click install
npx skills add https://github.com/412181-HerediaLara/ScaffoldingBE-FE --skill angular-http-412181-heredialara
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: angular-http
Source: https://github.com/412181-HerediaLara/ScaffoldingBE-FE/tree/main/FE/.agents/skills/angular-http
Command: npx skills add https://github.com/412181-HerediaLara/ScaffoldingBE-FE --skill angular-http-412181-heredialara

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Angular developers need consistent patterns for fetching API data, managing loading and error states, and migrating from Observable-based HTTP to signal-based reactivity in Angular v20+. ## Core Features & Use Cases - Signal-Based HTTP: Use httpResource() and resource() for reactive data fetching that automatically refetches when input signals change, with built-in loading, error, and status states. - Traditional HttpClient: Full coverage of GET, POST, PUT, PATCH, DELETE with headers, params, and response observation for complex Observable-based scenarios. - Interceptors & Error Handling: Functional interceptors for auth tokens, logging, and centralized error handling, plus retry and cancellation patterns. - Use Case: Build a paginated user list where changing the page signal automatically triggers a new API request, displays a spinner while loading, and shows a retry button on failure. ## Quick Start Ask the AI to implement an Angular component that fetches users from an API using httpResource with loading and error states.

Frequently Asked Questions about angular-http

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fetch API data in Angular using signals?

Use httpResource() from @angular/common/http to create a reactive HTTP request tied to signals. It exposes value(), isLoading(), error(), and status() signals, and automatically refetches when the signals used in its request function change.

What is the difference between httpResource and HttpClient in Angular?

httpResource wraps HttpClient with signal-based state management for declarative data fetching, while HttpClient returns Observables suited for complex operator chains or one-off mutations. Use httpResource for read-heavy reactive views and HttpClient for POST, PUT, and DELETE operations.

How do I add an auth token to Angular HTTP requests?

Create a functional interceptor implementing HttpInterceptorFn that clones the request with an Authorization header, then register it via provideHttpClient with withInterceptors in app.config.ts. The interceptor runs for every outgoing request automatically.

Can I cancel an HTTP request when search input changes in Angular?

Yes. The resource() API provides an abortSignal in its loader that automatically cancels the previous fetch when params change. With HttpClient, unsubscribe from the previous subscription or use switchMap to cancel in-flight requests.

How do I test Angular components that use httpResource?

Configure TestBed with provideHttpClientTesting, inject HttpTestingController, and use expectOne with the request URL to flush mock responses. Then assert on the resource's value() signal and call httpMock.verify() in afterEach.

When should I use resource() instead of httpResource()?

Use resource() for non-HTTP async operations or custom fetch logic, such as direct fetch calls, computed async data, or third-party SDK calls. Use httpResource() when you want HttpClient-backed requests with interceptors and typed HTTP semantics.