angular-http

Implement signal-based HTTP data fetching in Angular v20+ with resource(), httpResource(), and HttpClient.

2|Updated Jan 5, 2024
One-click install
npx skills add https://github.com/wilfriedago/dotfiles --skill angular-http-wilfriedago
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: angular-http
Source: https://github.com/wilfriedago/dotfiles/tree/main/agents/skills/angular-http
Command: npx skills add https://github.com/wilfriedago/dotfiles --skill angular-http-wilfriedago

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill simplifies and standardizes how Angular applications fetch data from APIs, manage loading and error states, and integrate with modern Angular features like Signals.

Core Features & Use Cases

  • Signal-Based HTTP: Use httpResource() for reactive, signal-driven API calls that automatically manage loading and error states.
  • Generic Async Data: Employ resource() for non-HTTP asynchronous operations or custom data loading logic.
  • Traditional HttpClient: Leverage HttpClient for Observable-based patterns and complex RxJS integrations.
  • Interceptors: Implement cross-cutting concerns like authentication and error handling.
  • Use Case: Quickly integrate a new feature that requires fetching user profiles, displaying them with loading indicators, and handling potential API errors gracefully, all while using the latest Angular patterns.

Quick Start

Use the angular-http skill to fetch user data for ID '123' using httpResource.

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 using Angular signals?

Fetch API data using Angular signals by implementing `httpResource()` for reactive, signal-driven API calls that automatically manage loading and error states. This approach standardizes data fetching within Angular applications using modern signal patterns.

What is the best way to handle loading and error states for HTTP requests in Angular?

Handle loading and error states by adopting `httpResource()` for signal-based data fetching, which automatically manages these conditions. Alternatively, use the traditional `HttpClient` with RxJS for Observable-based error handling patterns.

Can I use the traditional HttpClient with RxJS Observables instead of signal-based resource fetching?

Yes, you can use the traditional `HttpClient` with RxJS Observables for complex integrations. This Skill supports both signal-based patterns using `resource()` and traditional Observable-based approaches for managing HTTP data fetching.

Does this Angular HTTP approach support implementing interceptors for authentication?

Yes, this Angular HTTP approach supports implementing interceptors for cross-cutting concerns like authentication and error handling. It manages request and response handling alongside both `HttpClient` and signal-based fetching methods.

When should I use resource() versus httpResource() for async data loading in Angular?

Use `httpResource()` for standard signal-driven API calls, while `resource()` is designed for non-HTTP asynchronous operations or custom data loading logic. Both manage loading states within Angular v20+ applications.