liveBook · Manning

Computed signal

As explained in Modern Angular

The Angular computed function creates a derived read-only signal whose value is recalculated when the signals it reads change.

Angular’s computed function creates a derived, read-only signal from existing signals. It replaces much of the mapping work required with RxJS operators and keeps derived data tied to its sources. section 6.4 section 6.8

Pass computed a no-argument callback. The callback’s return value becomes the new signal’s value, and reading source signals inside the callback establishes automatic dependencies. When a dependency changes, Angular recalculates the result; otherwise, the computed value is stored for later reads. section 6.4.1

Deriving a doubled count

A count signal can expose a derived doubleCount signal with computed(() => count() * 2). Incrementing count changes doubleCount automatically, without manually synchronizing a second value. section 6.4.1

Combining multiple signals

computed can read several signals, such as a and b, to create sum. Updating either source causes the sum signal to reflect the new total.

How Modern Angular covers it

How deep it goes
Defines callback-based derivation, dependency tracking, automatic recalculation, and stored results for unchanged dependencies.
Examples
Uses doubled counts, sums of multiple signals, and recalculation logging to demonstrate derived values and caching.
What it assumes
Assumes signals and signal reads, then teaches derived values without manual signal updates.
What you can do after
Apply it via Angular’s computed function to build read-only derived signals without manual synchronization code.
How it connects
Connects signals with RxJS observables and operators through a simpler alternative for deriving reactive values.

Also explained in

Compare how 2 books explain computed signal →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Modern Angular. The section links point to the parts of the book it draws on.