INTERVIEW QUESTIONS

Angular Interview Questions

Practice Angular prompts by theme and build clearer interview answers.

Practice by topicAngular topic lensesClear answer prompts

Showing 6 Performance practice prompts

A

ANGULAR

What are Deferrable Views (`@defer`) in modern Angular?

`@defer` allows declarative lazy loading of component subtrees and their CSS/JS chunks directly in templates. It supports loading triggers like `@defer (on viewport; prefetch on idle) { <heavy-chart /> } @placeholder { <skeleton /> } @loading { <spinner /> } @error { <fallback /> }`, reducing initial bundle size and time-to-interactive.
◦ performance
A

ANGULAR

How does SSR with Hydration work in modern Angular, and what causes hydration mismatches?

Angular SSR renders full HTML on Node.js server engines. With Non-destructive Hydration (`provideClientHydration()`), the browser downloads the HTML and boots the Angular runtime without tearing down and recreating DOM nodes; instead, it matches existing DOM nodes with component view structures. Hydration mismatches occur if the client DOM diverges from the server output (e.g., accessing `window`, `localStorage`, or generating dynamic `Math.random()` or timestamps during render without browser-only guards).
◦ performance
A

ANGULAR

How does Ahead-of-Time (AOT) compilation differ from Just-in-Time (JIT) compilation in Angular?

JIT compilation ships Angular template compiler code to the browser and compiles templates at runtime, inflating bundle size and slowing down startup. AOT compilation runs during the build pipeline, converting templates and decorators into optimized JavaScript instructions before browser delivery. AOT catches binding errors during compile time, reduces bundle size by tree-shaking the compiler, and improves security by mitigating XSS injection.
◦ performance
A

ANGULAR

A large enterprise Angular dashboard renders hundreds of widgets and lags under frequent WebSocket updates. How do you optimize its change detection and rendering performance?

1) Convert all dashboard components and child widgets to `ChangeDetectionStrategy.OnPush`. 2) Adopt Angular Signals for high-frequency metrics so updates trigger fine-grained local reactivity rather than entire subtree checks. 3) Process rapid incoming WebSocket messages outside Angular with `NgZone.runOutsideAngular()`, buffering/throttling emissions (e.g., via `auditTime(100)` or `bufferTime`). 4) Virtualize long tables or grid widgets using `@angular/cdk/scrolling` (`cdk-virtual-scroll-viewport`). 5) Ensure all `@for` blocks use explicit `track` keys.
◦ performance
A

ANGULAR

A production Angular app suffers from recurring memory leaks when users navigate between tabs. How do you locate the cause and resolve it?

1) Capture Chrome DevTools heap snapshots before and after navigating back and forth across routes; filter for detached DOM trees and uncollected Component instances. 2) Look for unclosed RxJS subscriptions: replace manual subscriptions with `AsyncPipe` in templates or wrap with `takeUntilDestroyed()` in component logic. 3) Check for lingering DOM event listeners attached via `Renderer2` or `window.addEventListener` that lacked removal in `ngOnDestroy`. 4) Verify third-party canvas or chart libraries (e.g., Chart.js, Highcharts) have explicit `destroy()` invocations during cleanup.
◦ performance

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