Skip to main content

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(), and pipe(map(...)).
  • Signals = reactive state through synchronous references, without subscriptions or streams.

Breaking it down

  1. State storage. Previously, services would write:

    ts
    private user$ = new BehaviorSubject<User | null>(null);

    Now, simply:

    ts
    user = signal<User | null>(null);

    The value is stored directly in the signal, without a stream wrapper.

  2. Reading and reacting. Instead of subscribing (user$.subscribe(...)), the component simply reads user(). Angular tracks the dependencies itself and automatically updates the template when the signal changes.

  3. Changing state. Previously - user$.next(newUser). Now - user.set(newUser) or user.update(u => {...}). Everything is synchronous, with no subscribe.

  4. Composition. Instead of combineLatest, map, switchMap - now there is computed() and effect(). computed creates derived state, effect performs 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 ready
Premium

A concise answer to help you respond confidently on this topic during an interview.