This content originally appeared on DEV Community and was authored by Ahmad Alhafi
The Signals that were Developer Preview in Angular v17 are now stable
These include the view/content queries (viewChild, viewChildren, contentChild, contentChildren) and also output.
If you want a refresher on them, check out this post:
https://lnkd.in/dN_kPEhu
What’s new in Angular 19?
linkedSignal()
Remember computed() signals? linkedSignal() works similarly, but it’s writable.
It derives its value from another signal
You can also manually update it anytime you want
Example:
const count = linkedSignal(() => list().length);
count.set(0); // You can manually set it now, even though it’s derived
The next three signals are designed for reactive handling of async data, providing signals for loading, error, and value states.
resource()
A reactive API for managing async data (HTTP calls, loading, etc).
Provides loading, error, and value states as Signals
Supports reload and abort unnecessary operations (abortSignal)
Usage:
things.value();
things.error();
things.loading();
httpResource()
A specialized version of resource() for HTTP requests using Angular HttpClient.
Instead of building a resource from scratch:
const things = httpResource({
request: () => this.http.get(‘/api/things’),
});
Access states the same way:
things.value();
things.error();
things.loading();
rxResource()
For when you want to keep using RxJS Observables within Signals.
Instead of manually converting an Observable to a Signal (toSignal()), it wraps it automatically.
things.value();
things.error();
things.loading();
Quick comparison
resource() → base API, you can build any resource (not just HTTP)
httpResource() → ready-to-use specialization for HTTP requests using Angular HttpClient
rxResource() → specialization for RxJS Observables to work seamlessly in the Signals ecosystem
All these new Signals in Angular 19 are Developer Preview.
And that’s it!
If you’re still unsure how it works, check out this post:
https://lnkd.in/dvFG2P3d
This content originally appeared on DEV Community and was authored by Ahmad Alhafi