computed()

noun

say it: “kum-PYOO-tid” /kəmˈpjuːtɪd/

An Angular function that creates a signal whose value is worked out from other signals.

What does computed() do?

computed() creates a read-only signal whose value is worked out from other signals, and recalculates automatically when they change.

price = signal(20);
quantity = signal(3);
total = computed(() => this.price() * this.quantity()); // 60

In a sentence

  • “The total is computed from the cart items, so it's never out of date.”

Level: Journeyman · More Angular terms at this level

Updated