Angular Interview Questions and Answers
Components, templates and control flow, signals, DI, RxJS, routing, forms, change detection, SSR and NgRx.
225 questions for Angular interviews with answers and explanations - Junior, Middle and Senior levels. Sample questions, online quizzes and coding tasks.
- Signals
- RxJS
- DI
- Router
- Forms
- NgRx
Questions by level
Junior
Core concepts and syntax · 50 questions
Middle
Practice, nuances and optimization · 50 questions
Senior
Architecture, internals, edge cases · 50 questions
Sample questions
A few questions from each level with the correct answer and an explanation.
Angular · Junior
- What is Angular?
Correct answer: A full TypeScript framework from Google with components, DI, routing, forms and HTTP out of the box
Angular is an opinionated, batteries-included framework: the router, forms, HTTP client, DI, testing utilities and the CLI are all maintained by the Angular team. React, by contrast, is a rendering library around which you assemble your own stack.
- Which command creates a new Angular project?
Correct answer:
ng new my-appThe Angular CLI (
npm install -g @angular/cli) scaffolds the project withng new, runs the dev server withng serve, generates code withng generate component nameand builds withng build. - What does
standalonemean for an Angular component?Correct answer: The component declares its own dependencies in
importsinstead of belonging to an NgModuleStandalone components list the components, directives and pipes they use in
imports. Since Angular 19 components are standalone by default; NgModules are still supported but no longer required. - How is a standalone Angular application started?
Correct answer:
bootstrapApplication(App, appConfig)inmain.tsbootstrapApplicationrenders the root component and takes anApplicationConfigwithproviderssuch asprovideRouter(routes)andprovideHttpClient().bootstrapModuleis the older NgModule-based way.
Angular · Middle
- What changes when a component uses
ChangeDetectionStrategy.OnPush?Correct answer: Angular checks it only when it is marked dirty: an input reference changes, it or a child handles an event, a read signal changes, or
asyncdelivers a valueWith the default strategy every component is checked on each change detection run. OnPush skips whole subtrees that were not marked, which is the main runtime optimization in zone-based apps.
- When do you need
ChangeDetectorRef.markForCheck()?Correct answer: In an OnPush component when state changes outside Angular's knowledge, e.g. a manual
subscribethat sets a plain fieldmarkForCheckmarks the component and its ancestors so they are checked in the next run. Theasyncpipe and signals do this automatically, which is why they are preferred over manual subscriptions. - What does
ExpressionChangedAfterItHasBeenCheckedErrormean?Correct answer: A bound value changed during the same change detection pass after it was checked (only detected in dev mode)
In development Angular runs a second check to make sure data flows one way. It is typically caused by changing parent state in a child's
ngAfterViewInitor by getters that return new values each time. Fix the data flow instead of hiding it withsetTimeout. - How do signals improve change detection compared to plain fields?
Correct answer: Angular knows exactly which templates read a changed signal and marks only those components for refresh
A signal read in a template registers the view as a consumer. When the signal changes, that view is marked dirty - even in an OnPush component - without relying on Zone.js guessing that something might have changed.
Angular · Senior
- How does Zone.js let Angular know when to run change detection?
Correct answer: It patches async browser APIs (events, timers, promises, XHR) and notifies Angular when a task finishes, which triggers
ApplicationRef.tick()Zone.js doesn't know *what* changed, only that some async work completed, so Angular checks the tree from the root (skipping OnPush subtrees that are not dirty). That is simple but can cause many unnecessary checks.
- How do you enable zoneless change detection?
Correct answer: Add
provideZonelessChangeDetection()to the app providers and removezone.jsfrom polyfillsRecent Angular versions create new projects zoneless by default. Removing Zone.js reduces bundle size, makes stack traces cleaner and avoids unnecessary checks.
- In a zoneless app, which of these does NOT schedule change detection?
Correct answer: A
setTimeoutcallback assigning a new value to a plain class fieldWithout Zone.js Angular relies on explicit notifications: signal updates,
markForCheck()(also used byasync),ComponentRef.setInput, template/host listeners and attaching dirty views. A plain field change in a timer is invisible. - Which component style is already compatible with zoneless change detection?
Correct answer: OnPush components whose state lives in signals or flows through
async/markForCheckIf a component works correctly with OnPush, it is very likely zoneless-ready. APIs like
NgZone.onStable/onMicrotaskEmptydon't emit without Zone.js and should be replaced withafterNextRenderor signals.
Combined quizzes with this topic
Questions from several topics at once - just like an interview for a specific role.
Coding tasks
Write your solution right in the browser, and tests check it instantly. Interview classics: debounce, throttle, deepClone, Promise.all, EventEmitter, an LRU cache and more.
Open tasks →