Angular Interview Questions and Answers (Angular 18 and Later)
Last updated 2026-11-19
Modern Angular looks different from the Angular many tutorials still teach. Standalone components replaced NgModules as the default, signals now sit beside RxJS for state, templates use built-in control flow instead of structural directives, and dependency injection is often done with the inject function. Interviews at companies on recent versions test these, along with the classics: change detection, RxJS operators and the router.
This page covers both. Each answer states which version introduced a feature, so you can answer correctly whether the interviewer's project is on Angular 14 or on the latest release. For the role in general, also read how to crack a frontend interview.
| Version focus | Angular 18 and later, with notes on older behaviour |
|---|---|
| Key topics | Signals, standalone components, control flow, RxJS, DI, routing, forms |
| Questions here | 18 |
Old Angular versus current Angular
Many production apps still use NgModules, so an interviewer may ask about both. A safe pattern is to answer with the current approach, then add that older code does the same through a module. That shows you can work in a legacy codebase and also move it forward.
- Standalone components are the default in new projects, and from Angular 19 the standalone flag defaults to true.
- Built-in control flow with @if, @for and @switch arrived in 17 and is the recommended syntax, replacing ngIf and ngFor.
- Signal-based inputs, outputs and queries became stable in 19.
- Zone-less change detection was introduced as experimental in 18 and has matured in later releases.
RxJS is still examined
Signals handle synchronous state well, but asynchronous streams, HTTP, debouncing and cancellation remain RxJS territory. Be ready to explain switchMap versus mergeMap and to convert between the two worlds with toSignal and toObservable.
Angular Interview Questions and Answers (Angular 18 and Later): questions with worked answers
1 What is a standalone component and how does it differ from an NgModule-based one?
easyA standalone component declares its own dependencies in an imports array, so it needs no NgModule. It is bootstrapped with bootstrapApplication and configured with provider functions such as provideRouter and provideHttpClient. This removes the module boilerplate, makes lazy loading per component possible with loadComponent, and makes dependencies visible in the file that uses them.
typescript@Component({ selector: 'app-user-card', imports: [DatePipe, RouterLink], template: '<a [routerLink]="[\'/users\', user().id]">{{ user().name }}</a>', }) export class UserCardComponent { user = input.required<User>(); }2 What are Angular signals?
easyA signal is a reactive value that notifies its readers when it changes. You create one with signal(0), read it by calling count(), and write with set or update. computed() derives a read-only signal that recalculates lazily and is memoised, and effect() runs side effects when the signals it read change. Templates that read signals update precisely, which enables finer-grained change detection.
typescriptconst price = signal(100); const qty = signal(2); const total = computed(() => price() * qty()); qty.update(q => q + 1); // total() is now 3003 How does the new control flow syntax work?
easyAngular 17 added block syntax in templates: @if with @else, @for with a required track expression and an @empty block, and @switch. It is built into the compiler, needs no imports, and is faster than the older structural directives. The track expression, usually an ID, replaces the optional trackBy function and lets Angular reuse DOM nodes.
html@for (item of items(); track item.id) { <li>{{ item.name }}</li> } @empty { <li>No items</li> } @if (loading()) { <spinner /> } @else { <list [data]="items()" /> }4 What is the difference between signal inputs and the @Input decorator?
mediuminput() returns a read-only signal, so you read it as name() and can use it directly inside computed and effect. input.required() makes the value mandatory at compile time. Compared with @Input, you no longer need ngOnChanges or setters to react to changes, since computed values update automatically. The output() function replaces @Output with EventEmitter, and model() creates a two-way bindable signal. These became stable in Angular 19.
5 Explain dependency injection and the inject function.
mediumAngular builds an injector tree, and a class asks for a dependency by type rather than creating it. Providers are registered with providedIn: root for app-wide singletons, or in a component providers array for per-instance scope. The inject() function, usable in constructors, field initialisers and factory functions, is now preferred over constructor parameters because it works with inheritance and in functional guards and interceptors.
typescript@Injectable({ providedIn: 'root' }) export class UserService { private http = inject(HttpClient); getUser(id: number) { return this.http.get<User>('/api/users/' + id); } }6 How does change detection work, and what does OnPush change?
mediumBy default, zone.js patches async APIs and Angular checks every component from the root after any event, timer or request. With ChangeDetectionStrategy.OnPush a component is checked only when an input reference changes, an event originates in it, an async pipe emits, a signal it reads changes or markForCheck is called. OnPush with immutable data and signals greatly reduces work, and is the standard in modern code.
7 Compare switchMap, mergeMap, concatMap and exhaustMap.
mediumAll map each value to an inner observable and flatten. switchMap cancels the previous inner one when a new value arrives, which is right for search and route-based fetches. mergeMap runs all in parallel with no ordering. concatMap queues them and keeps order, good for saves that must happen in sequence. exhaustMap ignores new values while one is running, suited to a login button that should not be double-submitted.
typescriptthis.search.valueChanges.pipe( debounceTime(300), distinctUntilChanged(), switchMap(q => this.api.search(q)), takeUntilDestroyed(this.destroyRef), ).subscribe(r => this.results.set(r));8 How do you avoid memory leaks with observables?
mediumPrefer the async pipe or toSignal, which unsubscribe automatically. For manual subscriptions use takeUntilDestroyed from the core rxjs-interop package, which ties the subscription to the injection context. HTTP observables complete by themselves, but long-lived streams such as valueChanges, router events and websockets do not, so they need an explicit teardown.
9 How do you convert between signals and observables?
mediumtoSignal(obs$, { initialValue }) subscribes to an observable and exposes the latest value as a signal, unsubscribing on destroy. toObservable(sig) emits when a signal changes, though effects flush asynchronously so rapid changes can be coalesced. Use signals for state read in templates and observables for events over time such as debounced input, merging and retries.
10 How do you configure routing and lazy loading?
mediumDefine a Routes array and pass it to provideRouter. Use loadComponent for a single standalone component and loadChildren for a group of routes, so their code is split into a separate chunk. Guards are plain functions of type CanActivateFn that use inject(). withComponentInputBinding lets route params arrive as component inputs.
typescriptexport const routes: Routes = [ { path: 'admin', canActivate: [() => inject(AuthService).isAdmin()], loadChildren: () => import('./admin/routes').then(m => m.ADMIN_ROUTES) }, { path: 'users/:id', loadComponent: () => import('./user').then(m => m.UserComponent) }, ];11 Template-driven or reactive forms?
mediumTemplate-driven forms use ngModel and keep logic in the template, fine for simple forms. Reactive forms build a FormGroup in code, are synchronous and testable, support dynamic fields with FormArray and custom validators, and are the choice for anything complex. Since Angular 14 they are typed, so form.value has real types. Validators return an error object or null.
12 How do you write an HTTP interceptor in current Angular?
mediumUse a function of type HttpInterceptorFn registered with provideHttpClient(withInterceptors([...])). It receives the request and a next handler, and requests are immutable so you clone to modify them. Typical uses are attaching an auth header, global error handling and logging. Class-based interceptors still work through withInterceptorsFromDi.
typescriptexport const authInterceptor: HttpInterceptorFn = (req, next) => { const token = inject(AuthService).token(); return next(token ? req.clone({ setHeaders: { Authorization: 'Bearer ' + token } }) : req); };13 What is @defer and when do you use it?
medium@defer lazily loads a part of the template, along with the components it uses, in a separate chunk. Triggers include on viewport, on idle, on interaction, on timer and when a condition holds, with @placeholder, @loading and @error blocks. It is useful for below-the-fold content and heavy widgets, improving initial load without manual dynamic imports.
14 What is the difference between pure and impure pipes?
hardA pure pipe, the default, re-runs only when its input reference changes, so it can be cached and is cheap. An impure pipe, marked pure: false, runs on every change detection pass, which is needed when the input is mutated in place but is expensive. The async pipe is impure but internally optimised. Avoid impure pipes for filtering large lists, and compute in a signal instead.
15 What does zone-less change detection mean for an Angular app?
hardWithout zone.js, Angular no longer patches browser APIs to find out when to check for changes. Updates are triggered by signals, markForCheck, event listeners in templates and the async pipe. It reduces bundle size and avoids unnecessary checks, but code that mutated plain fields in a timer and relied on zone.js must move to signals. It began as experimental in version 18, so confirm the status for your version.
16 How does Angular handle hydration and server-side rendering?
hardWith server-side rendering, the server sends rendered HTML for a fast first paint and good SEO. Hydration then reuses that DOM in the browser instead of destroying and recreating it, enabled with provideClientHydration. Incremental hydration, introduced later, hydrates deferred blocks on demand. Code that touches window or document must be guarded or moved into afterNextRender, since it also runs on the server.
17 How do you structure state in a large Angular app?
hardKeep component-local state in signals. Share state through injectable services that expose read-only signals and update methods. For larger apps use NgRx SignalStore or NgRx Store with effects when you need time-travel debugging and strict patterns. Keep server cache concerns separate, and avoid copying HTTP data into several places.
18 How would you improve the performance of a slow Angular page?
hardProfile with the Angular DevTools profiler and Lighthouse first. Switch components to OnPush or signals, track list items properly in @for, lazy load routes and heavy components with @defer, use virtual scrolling from the CDK for long lists, optimise images with NgOptimizedImage, and check bundle sizes with the build stats. Remove unneeded zone-triggering listeners and polling.
Frequently asked questions
Is Angular still worth learning for jobs?
Yes. Large enterprises, banks and many service companies use Angular heavily, and openings for Angular developers remain steady, especially in India.
Do I need to learn RxJS for Angular interviews?
Yes. HTTP, forms and the router expose observables, and interviewers regularly ask about switchMap, debouncing and unsubscribing.
Should I answer with NgModules or standalone components?
Use standalone components for anything new, and mention NgModules as the older equivalent. Many codebases still use modules.
What is the best Angular version to prepare for?
Angular 18 or later. Know signals, control flow and standalone components, plus the older features your target team might still use.
Related guides
More in Role-wise Interview Questions by Job and Tech Stack
- Ansible Interview Questions and Answers
- API Testing and Postman Interview Questions
- Automation Testing Interview Questions and Answers
- AWS Interview Questions and Answers
- Azure Interview Questions and Answers
- Backend Developer Interview Questions and Answers
- Business Analyst Interview Questions and Answers
- Cloud Engineer Interview Questions and Answers
- Computer Vision Interview Questions and Answers
- Cybersecurity Interview Questions and Answers
- Data Analyst Interview Questions and Answers
- Data Engineer Interview Questions and Answers