Lesson 25 / 30

What are Signals?

A reactive primitive that tracks its own readers.

Why Angular added signals

A signal is a wrapper around a value that notifies interested code whenever it changes. Angular uses this to know exactly what to update, instead of checking the whole component tree.

Like a spreadsheet cell

Think of a signal as a spreadsheet cell: change it, and every formula cell that reads it recalculates automatically — no manual refresh.

signal()

signal(initialValue) creates one. Call it like a function to read it; call .set() or .update() to change it.

import { signal } from '@angular/core';

export class CounterComponent {
  count = signal(0);

  increment() {
    this.count.update(c => c + 1);
  }
}

Quick check: How do you read the current value of a signal named `count`?

  • count.value
  • count()
  • count.get()
Answer

count() — Signals are callable — `count()` reads the current value and registers a dependency.