Ch. 4 · Angular

Angular Computed Signals and Derived Values

Angular Computed Signals and Derived Values. Learn the reasoning, a practical example, common mistakes and an interview exercise.

~2 min readbeginnerupdated Oct 3, 2026

Computed signals express values derived from other signals. Angular tracks the signals read during computation, allowing dependencies to follow executed branches.

Before you start

You should understand a component’s class, template and dependencies. Follow both the framework lifecycle and the ownership of each value or resource. Apply examples inside an Angular application; the surrounding application configuration and imports depend on the feature being demonstrated.

The practical goal is to reason through this situation: A computed total reads quantities and prices; changing either invalidates that derived result. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.

Step-by-step walkthrough

Step 1: Identify editable sources

Keep the collection and filter writable. The matching count depends on both rather than representing a third independent input.

Step 2: Derive the result

Use computed and read both signals inside it. Dependencies follow the reads actually executed during calculation.

Step 3: Avoid synchronization copies

Do not use an Effect to copy the count into another writable signal; that creates additional ordering and consistency concerns.

Worked scenario

A computed total reads quantities and prices; changing either invalidates that derived result.

const items = signal(['Angular', 'React']);
const query = signal('a');
const count = computed(() => items().filter(item =>
  item.toLowerCase().includes(query().toLowerCase())
).length);
TypeScript

Import signal and computed from @angular/core. Count starts at two, becomes one for query ‘ang’, and reflects collection replacements without a separate setter.

Common mistake

Copying derived values into writable signals creates synchronization obligations.

Verify the behavior

Change the query and collection independently. Verify each invalidates the result and that consumers never need to update count manually.

Interview exercise

Calculate a filtered item count.

Answer and reasoning

Derive it with computed from the filter and collection, avoiding an Effect that copies the count into separate state.

Continue learning

Compare the scenario with the Angular interview questions and test your understanding with the Angular MCQs. For terminology and implementation details, consult the reference material.

More in Angular

read ✓Angular · mid

Angular Defer Blocks and Lazy Rendering

Load template regions on demand with @defer, choose a trigger, and use placeholders without delaying critical content.

~2 min readread →
esc