Angular Senior interview questions and answers
75 questions for a Angular (Senior) interview - with correct answers, explanations and links to the docs.
Take this quiz- 1.How does Zone.js let Angular know when to run change detection?
- 2.Why would you call
NgZone.runOutsideAngular()in a zone-based app? - 3.How do you enable zoneless change detection?
- 4.In a zoneless app, which of these does NOT schedule change detection?
- 5.Which component style is already compatible with zoneless change detection?
- 6.How does the default change detection traverse the component tree?
- 7.What does "glitch-free" mean for Angular signals?
- 8.What is wrong with this effect?
- 9.When would you pass a custom
equalfunction to a signal? - 10.What does
httpResource(the resource API) provide? - 11.How do you clean up inside an
effectbefore it re-runs or is destroyed? - 12.When is RxJS still a better fit than signals?
- 13.When might you use
ChangeDetectorRef.detach()? - 14.An OnPush parent has an OnPush child that reads a signal in its template. The signal changes. What is refreshed?
- 15.Why are getters or methods in templates a common performance problem?
- 16.In which order does Angular resolve
inject(Token)in a component? - 17.What is
runInInjectionContextfor? - 18.A recursive tree node component needs its parent node. Which injection option fits?
- 19.How do you load configuration before the app renders?
- 20.What is the difference between
providersandviewProvidersin a component? - 21.Why use an abstract class as a DI token?
- 22.What does hydration do in an Angular SSR app?
- 23.What commonly breaks hydration with a mismatch error?
- 24.What problem does
withEventReplay()solve? - 25.What does incremental hydration add?
- 26.Why doesn't the client repeat the API calls made during SSR?
- 27.How do you safely use browser-only APIs (
window,localStorage) in an SSR app? - 28.What does the
priorityattribute do withNgOptimizedImage? - 29.How do you preload lazy routes after the initial page has loaded?
- 30.What are budgets in
angular.json? - 31.Why might a component inside
@deferstill end up in the main bundle? - 32.Which tool shows which components are checked and how long change detection takes?
- 33.What does Angular do with a value bound to
[innerHTML]? - 34.When is
DomSanitizer.bypassSecurityTrustHtml()dangerous? - 35.How does
HttpClienthelp protect against CSRF? - 36.What is the data flow in NgRx Store?
- 37.Why are NgRx selectors created with
createSelectormemoized? - 38.What is an NgRx effect?
- 39.What is NgRx SignalStore?
- 40.When is a plain service with signals enough instead of a state library?
- 41.How are micro-frontends commonly built with Angular?
- 42.What does
ng update @angular/core @angular/clido besides bumping versions? - 43.How do you centrally report uncaught errors in an Angular app?
- 44.What are Angular Elements?
- 45.What is the main trade-off of Angular's built-in i18n (
@angular/localize)? - 46.What are component harnesses for?
- 47.Why doesn't this test replace the service used by the component?
- 48.How do you test guards and routed components together?
- 49.Why are nested
subscribecalls considered an anti-pattern? - 50.What is the difference between a cold and a hot Observable?
- 51.Why does
takeUntilDestroyed()throw when called inside a click handler? - 52.What is the risk of
shareReplay(1)withoutrefCount: trueon a long-lived source? - 53.In what order do functional interceptors process a request and its response?
- 54.How do you configure per-route rendering (SSR, prerender, client-only) in Angular SSR?
- 55.How can SSR code read the incoming HTTP request (e.g. a cookie)?
- 56.How do you make SSR wait for async work that isn't an HTTP request (e.g. a timer-based init)?
- 57.When is
ngSkipHydrationon a component a reasonable workaround? - 58.How do you use a CSP nonce with Angular's inline styles?
- 59.What does Angular's Trusted Types support help with?
- 60.What does
createEntityAdapterfrom@ngrx/entitygive you? - 61.What does
createFeatureadd in NgRx? - 62.What are Signal Forms in recent Angular versions?
- 63.Why might
RouteReuseStrategybe customized? - 64.How do you show a global progress bar while a lazy route is loading?
- 65.What is the main benefit of using
inject()over constructor parameters in base classes? - 66.What does
providedIn: 'platform'mean? - 67.In Angular SSR, where does user data typically leak between requests?
- 68.When does
effectbeatcomputed, and when is it a smell? - 69.Why does changing an object's property inside a signal not update the view?
- 70.How do you analyse which dependencies make the main bundle large?
- 71.How do you keep a large Angular codebase from creating circular or wrong-direction imports between features?
- 72.Why are template-driven forms harder to scale than reactive forms in complex screens?
- 73.What does
@defer (hydrate on interaction)do with incremental hydration? - 74.Why can a frequent
mousemovelistener hurt a zone-based app but less so a zoneless one? - 75.What is the typical architecture for NgRx effects that handle many concurrent requests to the same endpoint?