Angular

Angular Signals

Signals API, computed, effect, signal inputs, signal queries, reactivity model, migration from RxJS

20 interview questionsยท
Mid-Level
1

What is a signal in Angular?

Answer

A signal is a reactivity primitive introduced in Angular 16+ that wraps a value and automatically notifies consumers when that value changes. Unlike RxJS Observables, signals offer a simpler and more performant approach to managing reactive state. They are synchronous by default and integrate natively with Angular's change detection system.

2

How to create a signal with an initial value?

Answer

Use the signal() function with the initial value as parameter: signal(0) creates a signal containing 0. The returned signal is a getter function that can be called to read the value. To modify the value, use set(), update() or mutate() methods. The syntax is concise and avoids the verbosity of RxJS BehaviorSubject.

3

How to read the value of a signal?

Answer

Call the signal as a function: count() returns the current value. This syntax allows Angular to automatically track dependencies in reactive contexts (templates, computed, effect). Unlike Observables that require subscribe() or async pipe, signals offer synchronous and direct reading.

4

Which method to use to completely replace a signal's value?

5

How to update a signal based on its previous value?

+17 interview questions

Master Angular for your next interview

Access all questions, flashcards, technical tests, code review exercises and interview simulators.

Start for free