Angular signals · Trade-off
Signals or RxJS: when to use which
Practise this out loud
Say your answer out loud to an AI interviewer that follows up, and get a score for it.
Practise by voiceThe interviewer asks
Angular already had RxJS. Why did it add signals? In a new feature, how do you decide what goes in a signal and what stays an Observable?
Then
Follow-ups the interviewer asks next
- What problems of RxJS in templates do signals solve?
- What can't signals do well?
- Show toSignal and toObservable. What are their gotchas?
- A search box: signals, RxJS, or both?
- Would you rewrite working RxJS code to signals? When?
The answer
What a strong answer covers
- Signals: synchronous, always have a current value, update templates precisely, no subscribe or unsubscribe, glitch-free derived state. They drive zoneless change detection. Best for component and UI state.
- RxJS: streams of events over time, with cancellation, time operators (debounce, throttle, retry with backoff), combining async sources, WebSockets. Signals have no idea of time or of separate events.
- Bridges:
toSignal(obs$, { initialValue })subscribes in an injection context and unsubscribes on destroy; errors are thrown when the signal is read.toObservable(sig)emits asynchronously, so it can skip in-between values. - Usual split: streams and HTTP in RxJS or resources, state and template reads in signals. Search box: the query as a signal,
toObservable,debounceTimeandswitchMap, back withtoSignal; ordebounced()(experimental in v22) withhttpResource. - Don't rewrite working streams for fashion; migrate code when you touch it.
The red pen
Common traps
Avoid:"signals replace RxJS"; "RxJS is deprecated"; calling toSignal inside a method (NG0203) or on every render.
Practise this out loud
Say your answer out loud to an AI interviewer that follows up, and get a score for it.
Practise by voicePractise questions like this out loud
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.