Signals — Angular Technical Interview Questions & Answers
Signals
Signals
- A signal is a value Angular tracks. count = signal(0). Read count() in the template. Update with count.set(1) or count.update(n => n + 1). Don’t do count().n++ on an object — replace or use update.
- Board: click +1. Template shows the new number. Trap: treating a signal like a plain variable and mutating the inner array without notifying.
Technical Interview Tip: signal(0) + update. No silent mutate.
Code Examples for Signals
Signals — working example
import { Component } from "@angular/core";
@Component({
selector: "app-root",
template: `
<h1>{{ title }}</h1>
<button (click)="toggle()">Toggle</button>
<p *ngIf="open">Panel open</p>
`,
})
export class AppComponent {
title = "Angular practice";
open = true;
toggle() {
this.open = !this.open;
}
}Signals: toggle open. Say whether the panel is on screen after one click.
How to Explain Signals to an Interviewer
How do you change a signal?
set update Not mutate in place