InterviewHubPRO
Section Overview
Q280

Question 280 of 283

Part 10: Reactive Forms, Standalone Components, Signals & NgRx (256 - 283)

99%
Angular & Signals (283 Qs)•Part 10: Reactive Forms, Standalone Components, Signals & NgRx (256 - 283)

What are Angular Signals?

A signal is a wrapper around a value that can notify interested consumers when that value changes. Signals can contain any value, from simple primitives to complex data structures.

Practical Code Example

typescript
// Angular Signals: Fine-grained reactivity primitives:
import { signal, computed, effect } from '@angular/core';

const count = signal(0);
const doubleCount = computed(() => count() * 2);

effect(() => {
  console.log(`Count changed to: ${count()}, double is: ${doubleCount()}`);
});

count.set(5); // Logs: Count changed to: 5, double is: 10
count.update(n => n + 1); // 6