Create an Angular Computed Signal on Top of Another Computed

InstructorTomasz Ducin

Share this video with your friends

Send Tweet

Computed signals in Angular allow for the creation of derived values based on other signals, including other computed signals. This enables the composition of complex calculations and transformations by building upon existing signals.

When creating computed signals that depend on other computed signals, it's crucial to:

  • Ensure that there are no cyclic dependencies, where two or more computed signals directly or indirectly depend on each other
  • Consume the computed signal by a live consumer, such as a template, to trigger re-evaluation when dependencies change

Angular's reactivity system automatically detects and prevents cyclic dependencies in computed signals, throwing an error if such a scenario is encountered.