How do signals replace the "observable store" pattern?
signals in Angular replace the observable store pattern by removing the need for streams (Observable) to track state.
In short
- Observable store = reactive state through RxJS streams; subscriptions, unsubscriptions, BehaviorSubject,
next(), andpipe(map(...)). - Signals = reactive state through synchronous references, without subscriptions or streams.
Breaking it down
-
State storage. Previously, services would write:
tsprivate user$ = new BehaviorSubject<User | null>(null);Now, simply:
tsuser = signal<User | null>(null);The value is stored directly in the signal, without a stream wrapper.
-
Reading and reacting. Instead of subscribing (
user$.subscribe(...)), the component simply readsuser(). Angular tracks the dependencies itself and automatically updates the template when the signal changes. -
Changing state. Previously -
user$.next(newUser). Now -user.set(newUser)oruser.update(u => {...}). Everything is synchronous, with nosubscribe. -
Composition. Instead of
combineLatest,map,switchMap- now there iscomputed()andeffect().computedcreates derived state,effectperforms side effects on changes.
The main difference
Signals provide reactivity without streams, subscriptions, or memory leaks. Angular itself knows which templates or computations depend on which signals, and updates only the necessary parts of the tree.
The observable store was "reactive" through RxJS's push model, while signals are reactive through a pull model of reactive references.
Short Answer
Interview readyA concise answer to help you respond confidently on this topic during an interview.