Signals · mid
httpResource, and signals or RxJS
httpResource loads data from a signal-based URL and gives signals for loading, error and value. Choose signals for UI state and RxJS for streams over time.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
httpResourceandresourceare stable in v22 (facts.md).- Example:
orders = httpResource<Order[]>(() => "/api/customers/" + this.customerId() + "/orders"). When the input signal changes, it loads again. - The resource gives
isLoading(),error(),hasValue(),value()andreload(). Use them in@ifblocks. - Signals are synchronous, always have a value, update templates precisely, need no subscribe and drive zoneless change detection.
- RxJS is best for streams of events over time with cancellation and time operators: debounce, throttle, retry, combining sources.
- They work together:
toSignalandtoObservableconvert between them. - Migrating an old component: write tests first, take a profiler baseline, run the signal schematics (inputs, outputs, queries), then review by hand.
- Inputs the component writes to are skipped by the schematic: they need
model()or a redesign.
The red pen
Common traps: mistake → fix
Mistake: Signals replace RxJS
Fix: they cover state; RxJS stays for streams and events (facts.md).
Mistake: A migration schematic finishes the job
Fix: it skips some cases and you must review by hand.
Easy to hard
Questions interviewers ask, easy to hard
- What does httpResource give you compared with HttpClient and a subscription?
- When would you choose RxJS over a signal?
- How do you move a big old component to signals safely?
- How do you turn an Observable into a signal?
Practise
Practise with these questions
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.