INTERVIEW QUESTIONS

Angular Interview Questions

Practice Angular prompts by theme and build clearer interview answers.

Practice by topicAngular topic lensesClear answer prompts

Showing 4 Change Detection practice prompts

A

ANGULAR

How does Angular Change Detection work by default vs OnPush?

By default (`ChangeDetectionStrategy.Default`), Angular checks every binding in the entire component tree from top to bottom on every asynchronous browser event (HTTP, clicks, timers) via Zone.js. With `ChangeDetectionStrategy.OnPush`, Angular skips re-evaluating the component unless: 1) `@Input()` reference identity changes, 2) an event originating within the component fires, 3) an AsyncPipe emits, or 4) `ChangeDetectorRef.markForCheck()` is called.
◦ change detection
A

ANGULAR

What is `trackBy` in `*ngFor` and why is `track` mandatory in `@for`?

Without tracking, when an array changes, Angular re-creates the entire DOM node list for all items. `trackBy` (or `track item.id` in `@for`) gives Angular an immutable unique identity key. Angular then diffs items by key, reusing existing DOM nodes and only inserting, deleting, or moving DOM elements that actually shifted.
◦ change detection
A

ANGULAR

How does Zone.js patch the asynchronous runtime, and what is Zoneless Angular architecture?

Zone.js monkey-patches browser asynchronous execution primitives (e.g., `setTimeout`, `Promise`, `addEventListener`, `XMLHttpRequest`) into an execution context. When an async event finishes, Zone.js calls `onMicrotaskEmpty` to notify `ApplicationRef.tick()`, triggering top-to-bottom change detection. In Zoneless Angular (`provideExperimentalZonelessChangeDetection()`), Zone.js is removed entirely. Reactivity is driven purely by Signals and explicit notifications (`markForCheck`), dramatically reducing bundle size, improving performance, and clarifying stack traces.
◦ change detection
A

ANGULAR

What is `NgZone.runOutsideAngular()` and when is it required?

By default, Zone.js triggers change detection whenever any registered event or timer runs. For high-frequency events (such as `mousemove`, `scroll`, canvas animations, or WebSockets emitting hundreds of packets per second), wrapping the listener inside `this.ngZone.runOutsideAngular(() => el.addEventListener('scroll', handler))` prevents triggering change detection on every event, re-entering Angular with `ngZone.run()` only when meaningful UI state updates are required.
◦ change detection

Your next interview is closer than you think.

Practice smarter and land better opportunities.

✓ Start with the free plan✓ No credit card✓ Cancel anytime
Start preparing free