200 Angular Interview Questions With Short Answers

Two hundred Angular questions with short answers you can say in a minute. They cover signals, RxJS, forms, routing and Angular 22.

Smiling programmer working on an Angular app across two monitors in an office
Photo: Pexels

Angular is a TypeScript framework from Google for building web apps, with routing, forms, an HTTP client and testing tools built in. Banks, insurers and IT service firms use it for big internal and customer apps. So Angular roles stay common in job listings in India and abroad.

Angular interview questions today center on three areas. First comes the core: components, templates, dependency injection and RxJS. Next come signals, which now drive change detection. Then come the newest defaults in Angular 22, such as OnPush for every component and stable signal forms. Candidates who still answer only with NgModules and Zone.js sound out of date.

This post gives 200 questions with short, correct answers and small code samples. Then it covers the mistakes that cost candidates offers, and answers a few questions people ask about Angular rounds.

Programmer typing TypeScript code for an Angular project
Photo: Pexels

Angular Versions That Change Your Answers

Angular now ships a major version once a year. Until Angular 22, majors came every six months. Then, from v22 on, the Angular release policy moved to a 12-month cycle. Each major gets 12 months of active support and 12 more months of long-term support.

So the version on your résumé matters. For example, an answer about change detection is different for a v15 app and a v22 app. The table maps the big changes that interviewers ask about.

VersionReleasedChange that shows up in interviews
v17November 2023New @if and @for blocks, @defer and a faster build tool
v19November 2024Every new component is standalone by default
v20May 28 of last yeareffect(), linkedSignal() and toSignal() left developer preview
v21November 19 of last yearNew apps run with no Zone.js by default
v22June 3, 2026OnPush by default, stable signal forms, one major a year

Also, v21 stays in long-term support until June 2027, so many teams will run it for a while yet.

Angular Basics and Architecture

1. What is Angular?

Angular is an open-source, TypeScript-based framework for building single-page web apps. It gives you components, routing, forms, an HTTP client, dependency injection and a CLI in one package. Google maintains it.

2. How is Angular different from AngularJS?

AngularJS (version 1.x) used JavaScript, controllers and $scope. Angular (version 2 and later) is a full rewrite in TypeScript built around components. Also, AngularJS reached end of support at the end of 2021, so new work happens only in Angular.

3. Why does Angular use TypeScript?

TypeScript adds static types to JavaScript. So errors such as a wrong property name show up at build time, not in production. Also, Angular’s compiler uses type information to check templates.

4. What are the main building blocks of an Angular app?

The main parts are components, templates, directives, pipes, services and the router. Dependency injection connects them. Older apps also group these into NgModules.

5. What is the Angular CLI?

The Angular CLI is the command-line tool for creating and running Angular projects. For example, ng new creates an app, ng generate component adds a component, and ng serve runs a dev server. It also runs builds, tests and upgrades with ng update.

6. What does ng update do?

ng update upgrades Angular packages and runs migration scripts that rewrite your code for breaking changes. For instance, a migration can swap a deprecated API for its new form. Upgrade one major version at a time.

7. What is a single-page application?

A single-page application (SPA) loads one HTML page and then changes the view with JavaScript. So moving between screens does not reload the page. Angular’s router handles this by swapping components based on the URL.

8. What is the role of main.ts?

main.ts is the entry point. In a standalone app, it calls bootstrapApplication(AppComponent, appConfig). In an older NgModule app, it calls platformBrowserDynamic().bootstrapModule(AppModule).

9. What is appConfig in a standalone app?

appConfig is an ApplicationConfig object with a providers array. You add app-wide setup there, such as provideRouter(routes) and provideHttpClient(). It takes the place of the imports and providers in an old root module.

10. What is an NgModule?

An NgModule is a class with @NgModule that groups components, directives and pipes and sets up providers. Before standalone components, every component had to belong to one. Today they are optional, but many older codebases still use them.

11. What are standalone components?

Standalone components do not need an NgModule. Instead, they list their own dependencies in an imports array. Since Angular 19, components are standalone by default, so you no longer write standalone: true.

12. How do you migrate an app to standalone?

Run the schematic ng generate @angular/core:standalone. It converts declarations, removes unused NgModules and switches bootstrapping, in three passes. Then run tests after each pass.

13. What is the difference between JIT and AOT compilation?

Just-in-time (JIT) compiles templates in the browser at runtime. Ahead-of-time (AOT) compiles them during the build. AOT is the default, so apps load faster and template errors appear at build time.

14. What is Ivy?

Ivy is Angular’s compilation and rendering engine, the default since version 9. It produces smaller code, supports better tree shaking and made features like standalone components possible. The older View Engine is gone.

15. What is angular.json?

angular.json is the workspace config file. It holds build and serve options for each project, such as output paths, styles, assets, file replacements and size budgets. The CLI reads it for every command.

16. What are budgets in angular.json?

Budgets set size limits for bundles and component styles. If the initial bundle passes the warning or error size, the build warns or fails. As a result, teams catch large imports before release.

17. Which build system does Angular use now?

New projects use the application builder based on esbuild, with Vite for the dev server. It became the default for new apps in Angular 17. It builds faster than the older webpack builder.

18. How do you handle environment settings?

Run ng generate environments to create environment files. Then use fileReplacements in angular.json to swap them per build. Do not put secrets in them, since they ship to the browser.

19. What is a workspace with multiple projects?

One Angular workspace can hold several apps and libraries. For example, ng generate library ui-kit creates a shared library. Large teams often use Nx on top for build caching.

20. What is Angular Material and the CDK?

Angular Material is Google’s UI component library for Angular. The Component Dev Kit (CDK) holds the lower-level parts, such as overlays, drag and drop and virtual scroll. You can use the CDK alone to build your own design system.

21. What is Angular Aria?

Angular Aria (@angular/aria) is a set of headless, accessible UI patterns, such as menus, tabs and listboxes. It handles keyboard and ARIA behaviour, while you bring the styles. It became stable in Angular 22.

22. What is the Angular DevTools extension?

Angular DevTools is a browser extension for Chrome and Firefox. It shows the component tree, inputs, outputs and signals, and has a profiler for change detection. So you can see which components ran and how long each took.

23. How does Angular support AI coding tools?

The CLI includes an MCP server that coding assistants can connect to. Also, angular.dev publishes prompts, Agent Skills and AI setup guides. In v22, the docs added WebMCP support as a new feature.

24. What is strict mode in Angular?

Strict mode turns on strict TypeScript and strict template checks when you create a project. So templates catch null errors and wrong types. New projects use it by default.

25. What are schematics?

Schematics are code generators and code changers used by the CLI. For example, ng add @angular/material runs a schematic that installs and sets up Material. Migrations in ng update are schematics too.

Components, Templates and Data Binding

26. What is a component?

A component is a TypeScript class with a @Component decorator that controls part of the screen. It has a template for markup, styles and a selector. For example, <app-cart> renders the CartComponent.

27. What are the main @Component properties?

The common ones are selector, template or templateUrl, styles or styleUrl, imports, providers, changeDetection and host. Each component needs a template. Since v19, you no longer set standalone.

28. What is data binding?

Data binding connects the class and the template. Angular has interpolation {{ value }}, property binding [prop], event binding (event) and two-way binding [(ngModel)]. So data moves from class to view, view to class, or both ways.

29. What is the difference between interpolation and property binding?

Interpolation turns a value into text: <p>{{ name }}</p>. Property binding sets a DOM property directly: <img [src]="url">. Use property binding for non-text values, such as booleans and objects.

30. What is event binding?

Event binding runs a method when an event fires: <button (click)="save()">. You can pass the event with $event. Also, Angular lets you filter keyboard events, as in (keyup.enter).

31. How does two-way binding work?

Two-way binding is property binding plus event binding. [(value)] is short for [value]="v" (valueChange)="v = $event". In modern Angular, a model() input creates that pair for you in a child component.

32. What is the difference between attribute and property binding?

Properties belong to DOM objects, and attributes belong to HTML. Some attributes have no matching property, such as colspan on a table cell or ARIA attributes. For those, use [attr.aria-label]="label".

33. How do you bind classes and styles?

Use [class.active]="isActive" for one class or [class]="{ active: isActive }" for several. For styles, use [style.width.px]="w" or [style] with an object. These replace most uses of ngClass and ngStyle.

34. What are signal inputs?

Signal inputs are declared with input() in place of @Input(). For example, name = input<string>() and id = input.required<number>(). The value is a signal, so you read it with name(), and you can build computed() values from it.

35. How do you declare outputs today?

Use the output() function: saved = output<Order>(). Then call this.saved.emit(order). It replaces @Output() with EventEmitter, though both still work.

36. What does model() do?

model() creates a writable input that also emits changes back to the parent. So a child with value = model(0) supports [(value)] from the parent. Calling this.value.set(5) updates both sides.

37. What is a required input?

A required input must be bound by the parent, or the build fails. Use input.required<T>() with signals or @Input({ required: true }) with decorators. As a result, missing bindings show up at compile time.

38. What is an input transform?

A transform changes the raw input value before the component sees it. For example, disabled = input(false, { transform: booleanAttribute }) lets the parent write <app-btn disabled>. Angular ships booleanAttribute and numberAttribute.

39. What is the new control flow syntax?

Angular 17 added built-in blocks: @if, @for and @switch. They replace *ngIf, *ngFor and ngSwitch with cleaner syntax and better type checks. Also, they need no imports.

40. How does @for work, and why is track required?

@for (item of items; track item.id) { ... } repeats a block. The track expression tells Angular which item is which, so it can reuse DOM nodes when the list changes. You can also add an @empty block for an empty list.

41. What is @let?

@let declares a local variable in a template: @let total = price() * qty();. It is handy for reusing a value or an async pipe result. It is read-only and scoped to its block.

42. What is @defer?

@defer lazy-loads a part of a template and its dependencies. Triggers include on viewport, on idle, on interaction, on hover, on timer and on immediate. You can add @placeholder, @loading and @error blocks.

43. What is the difference between ng-template and ng-container?

<ng-template> defines markup that does not render until something tells it to, like a structural directive or ngTemplateOutlet. <ng-container> is a grouping element that renders its content but adds no DOM node. So use ng-container to group without a wrapper div.

44. What is content projection?

Content projection places markup from the parent inside the child’s template with <ng-content>. With select, you can project into several slots, such as a card header and body. It works like children in other frameworks.

45. What is a template reference variable?

A template reference variable gives a name to an element or directive in a template, like <input #email>. Then you can use email.value elsewhere in the template. It is also how viewChild can find elements by name.

46. What are viewChild and contentChild?

viewChild() finds an element or child component in the component’s own template. contentChild() finds one in projected content. Both return signals, and the viewChildren and contentChildren versions return lists.

47. What is view encapsulation?

View encapsulation controls how component styles are scoped. The default, Emulated, adds unique attributes so styles stay inside the component. ShadowDom uses the browser’s shadow DOM, and None makes styles global.

48. What is the :host selector?

:host targets the component’s own host element from its styles. For example, :host { display: block; }. Also, :host(.active) applies styles when the host has a class.

49. What is the host property in @Component?

The host object binds properties, attributes and events on the host element. For example, host: { '[class.open]': 'isOpen()', '(click)': 'toggle()' }. The Angular style guide prefers it over @HostBinding and @HostListener.

50. Name the lifecycle hooks in order.

The order is ngOnChanges, ngOnInit, ngDoCheck, ngAfterContentInit, ngAfterContentChecked, ngAfterViewInit, ngAfterViewChecked and ngOnDestroy. Constructor runs before all of them. ngOnChanges runs only when the component has inputs.

51. When should you use ngOnInit instead of the constructor?

Use the constructor only for simple field setup and inject() calls. Use ngOnInit for work that needs input values, because inputs are not set yet when the constructor runs. With signal inputs, much of this logic moves into computed() instead.

52. What does ngOnChanges receive?

It receives a SimpleChanges object with an entry for each changed input. Each entry has previousValue, currentValue and firstChange. With signal inputs, you rarely need it, since computed() and effect() react to changes for you.

53. What is ngOnDestroy used for?

ngOnDestroy runs just before Angular removes the component. Use it to clean up timers and manual subscriptions. In modern code, DestroyRef and takeUntilDestroyed() do the same job without the hook.

54. What are afterNextRender and afterEveryRender?

These functions run code after Angular has rendered the DOM. afterNextRender runs once, which works well for setting up a chart library. afterEveryRender runs after each render. Both run only in the browser, not during server rendering.

55. How do components talk to each other?

Parents pass data down with inputs, and children send events up with outputs. Siblings or distant components share a service, often holding signals or an RxJS subject. For a direct handle, a parent can use viewChild().

Angular Interview Questions on Directives and Pipes

56. What is a directive?

A directive is a class that adds behaviour to elements in a template. Components are directives with a template. The other two kinds are attribute directives and structural directives.

57. What is an attribute directive?

An attribute directive changes how an element looks or acts. For example, a highlight directive can change the background color on hover. Built-in examples include ngClass, ngStyle and ngModel.

58. Write a simple attribute directive.

@Directive({ selector: '[appAutofocus]' })
export class AutofocusDirective {
  private el = inject(ElementRef);
  constructor() { afterNextRender(() => this.el.nativeElement.focus()); }
}

Then add appAutofocus to an input and import the directive in the component.

59. What is a structural directive?

A structural directive adds or removes DOM elements. The asterisk in *ngIf or *ngFor is shorthand for wrapping the element in an <ng-template>. Built-in control flow blocks now cover most cases.

60. How do you write a custom structural directive?

Inject TemplateRef and ViewContainerRef. Then call createEmbeddedView(templateRef) to show the template, or call the container’s remove() method to hide it. For example, an *appHasRole="'admin'" directive shows content only for admins.

61. What are host directives?

Host directives let a component or directive apply other directives to its host element. You list them in hostDirectives. So a MenuItem component can reuse a standalone Tooltip directive without the user adding it in the template.

62. What is a pipe?

A pipe transforms a value in a template, like {{ price | currency:'INR' }}. Built-in pipes include date, currency, decimal, percent, uppercase, json, slice and async. You can chain them.

63. How do you create a custom pipe?

@Pipe({ name: 'initials' })
export class InitialsPipe implements PipeTransform {
  transform(name: string) { return name.split(' ').map(p => p[0]).join(''); }
}

Then import InitialsPipe in the component and use {{ user.name | initials }}.

64. What is the difference between pure and impure pipes?

A pure pipe runs only when its input reference changes. An impure pipe, set with pure: false, runs on every change detection cycle. So keep pipes pure, and pass a new array if you want a pure pipe to rerun.

65. What does the async pipe do?

The async pipe subscribes to an Observable or Promise and shows the latest value. It also unsubscribes when the component is destroyed. Also, it marks the component for check, so it works with OnPush.

66. Why prefer pipes over method calls in templates?

A method call like {{ getTotal() }} runs on every change detection cycle. A pure pipe runs only when its input changes. Today, a computed() signal is often the cleanest choice for derived values.

67. How do you format dates for India?

Use the date pipe with a format and locale, such as {{ d | date:'dd/MM/yyyy' }}. For Indian number grouping, register the en-IN locale data and set LOCALE_ID. Then the currency pipe can show lakhs and crores grouping.

68. What is ngClass compared with class binding?

ngClass takes a string, array or object of classes. Class binding with [class] now supports the same inputs. So the Angular docs suggest class bindings in new code, since they need no import.

69. What is ngTemplateOutlet?

ngTemplateOutlet renders an <ng-template> at a spot, with an optional context object. For example, a table component can accept a row template from the parent. This lets users customise parts of a reusable component.

70. What is the difference between ElementRef and Renderer2?

ElementRef gives you the native element. Renderer2 lets you change elements through Angular’s renderer, which also works during server rendering. So use Renderer2 or bindings when you change the DOM by hand.

71. What is the HostListener decorator?

@HostListener('window:resize', ['$event']) listens to events on the host or on global targets. It still works, but the style guide prefers the host property in the decorator. Both clean up listeners automatically.

72. What is the i18n support in Angular?

Angular marks text with the i18n attribute and $localize in code. Then ng extract-i18n produces translation files, and the build creates one bundle per locale. Some teams use runtime libraries like Transloco instead.

73. How do you sanitize HTML in Angular?

Angular sanitizes values bound to [innerHTML], URLs and styles by default. So script tags are stripped. If you must trust content, use DomSanitizer.bypassSecurityTrustHtml, but only for content you control.

74. How does Angular protect against XSS?

Angular treats all values as untrusted and escapes interpolated text. It also sanitizes values in risky contexts like innerHTML and href. Avoid building templates from user strings, and avoid direct DOM writes with nativeElement.innerHTML.

75. What is NgOptimizedImage?

NgOptimizedImage is a directive used with ngSrc in place of src. It sets lazy loading, warns about missing sizes and adds fetchpriority="high" for images marked priority. As a result, it improves Largest Contentful Paint.

Read also: 200 Networking Interview Questions With Answers

Dependency Injection and Services

76. What is dependency injection?

Dependency injection (DI) means a class asks for what it needs, and the framework creates and supplies it. So a component asks for CartService instead of creating it with new. This makes code easier to test and swap.

77. What is a service?

A service is a class that holds logic or data shared across components, such as API calls or a logged-in user. It is marked with @Injectable(). Components get it through DI.

78. What does providedIn: ‘root’ mean?

@Injectable({ providedIn: 'root' }) registers one shared instance for the whole app. It is also tree-shakable, so if nothing injects the service, it is left out of the bundle. Most services use it.

79. What is the inject() function?

inject(Token) gets a dependency without a constructor parameter, for example private http = inject(HttpClient). It works in field initializers, constructors and factory functions. Functional guards and interceptors depend on it.

80. inject() or constructor injection?

Both work, but the Angular docs and style guide now prefer inject(). It reads better with inheritance and works in functions. Also, it avoids long constructor lists.

81. What is an injector hierarchy?

Angular has environment injectors, such as the root one and route-level ones, and element injectors created by components and directives. A lookup starts at the element and walks up. So a provider on a component gives each instance of that component its own service.

82. What happens when you provide a service in a component?

Each instance of that component gets a new instance of the service. Its children share it. For example, every tab in a tab set can have its own form state service.

83. What are useClass, useValue, useFactory and useExisting?

They define how a provider creates a value. useClass swaps in another class, useValue gives a fixed value, useFactory calls a function, and useExisting aliases another token. For example, { provide: Logger, useClass: ConsoleLogger }.

84. What is an InjectionToken?

An InjectionToken is a token for values that are not classes, such as a config object or a string. You create it with new InjectionToken<AppConfig>('app.config'). Then you provide it and inject it like a service.

85. What are multi providers?

With multi: true, many providers add values to the same token, and injecting it returns an array. For example, several functions can register under one token for app startup tasks. HTTP interceptors used this pattern in the class-based API.

86. What do optional, self, skipSelf and host mean?

These options change how DI searches. optional returns null instead of throwing. self looks only in the current injector, skipSelf starts at the parent, and host stops at the host component. You pass them to inject(), such as inject(Token, { optional: true }).

87. What is provideAppInitializer?

provideAppInitializer(() => ...) runs a function during app startup, before the first render. If it returns a promise or Observable, Angular waits for it. Teams use it to load runtime config or check a session.

88. What is an environment injector?

An environment injector holds app-wide or route-level providers, not ones tied to a component. The root injector is one. Also, lazy routes with a providers array get their own child environment injector.

89. How do you provide a service only to a lazy route?

Add it to the route’s providers array:

{ path: 'admin', providers: [AdminService], loadChildren: () => import('./admin/routes') }

The service is created when the route first loads and is shared within that route tree.

90. What is a singleton service, and how can you break it by mistake?

A singleton has one instance for the whole app, usually via providedIn: 'root'. You break it by also listing the service in a component’s or lazy route’s providers, which creates a second instance. Then two parts of the app see different data.

91. How do you share state with a service?

Keep the data in a private signal and expose a read-only version:

private items = signal<Item[]>([]);
readonly list = this.items.asReadonly();
add(i: Item) { this.items.update(a => [...a, i]); }

Components then read cart.list() and call cart.add().

92. What is forwardRef in DI?

forwardRef(() => Type) lets you refer to a class that is not defined yet in the file. It helps with circular references, for example when a directive provides itself as NG_VALUE_ACCESSOR. Most code does not need it.

93. What is the DestroyRef service?

DestroyRef lets any injectable code register cleanup with onDestroy(fn). For example, a helper function can stop a timer when its component goes away. takeUntilDestroyed() uses it inside.

94. What is runInInjectionContext?

runInInjectionContext(injector, fn) runs a function where inject() is allowed. You need it when you call helpers that use inject() outside a constructor or field, such as inside a method. Otherwise Angular throws an injection context error.

95. What is an HTTP interceptor?

An interceptor runs code on every HTTP request and response. Common uses are adding an auth header, logging and handling errors in one place. Functional interceptors are plain functions of type HttpInterceptorFn.

96. Write an interceptor that adds a token.

export const authInterceptor: HttpInterceptorFn = (req, next) => {
  const token = inject(AuthService).token();
  return next(req.clone({ setHeaders: { Authorization: `Bearer ${token}` } }));
};

Register it with provideHttpClient(withInterceptors([authInterceptor])).

97. Why do you clone the request in an interceptor?

HttpRequest objects cannot be changed. So you call req.clone() with the new headers or URL and pass the copy on. This keeps the original safe if a retry runs.

98. What is the Angular style guide’s advice on services?

Give each service one job, put it near where it is used, and name the file after what it does, like user-api.ts. Also prefer inject() and providedIn: 'root'. The style guide on angular.dev was updated for v20 and later.

99. How do you mock a service in a test?

Provide a fake with { provide: UserService, useValue: { load: () => of(user) } } in TestBed.configureTestingModule. Then the component under test gets the fake. Jasmine spies or Vitest mocks can track calls.

100. Can you inject a service into a pipe or directive?

Yes. Pipes and directives take part in DI like components. For example, a translate pipe injects a translation service. Note that a pure pipe will not rerun when the service’s data changes unless the input changes too.

Angular Signals Questions

101. What is a signal?

A signal is a wrapper around a value that tells Angular when the value changes. You read it by calling it, like count(), and change it with set or update. Templates that read a signal update when it changes.

102. How do you create and change a signal?

const count = signal(0);
count.set(5);
count.update(n => n + 1);

set replaces the value, and update computes the new value from the old one. Signals compare values with Object.is by default.

103. What is computed()?

computed(() => price() * qty()) creates a read-only signal derived from other signals. It runs lazily and caches the result until one of its inputs changes. So you avoid recalculating on every check.

104. What is effect()?

effect(() => ...) runs code whenever the signals it reads change. Use it for side effects such as logging, syncing to localStorage or calling a non-Angular library. Do not use it to copy one signal into another, because computed or linkedSignal does that better.

105. Where can you create an effect?

Create effects in an injection context, such as a constructor or field initializer. Otherwise pass an injector option. The effect is destroyed with its component or service.

106. How does an effect clean up?

The effect function receives an onCleanup callback. For example, effect(onCleanup => { const t = setInterval(...); onCleanup(() => clearInterval(t)); }). Angular calls the cleanup before the next run and on destroy.

107. What is untracked()?

untracked(() => user()) reads a signal without making it a dependency. So an effect can log the current user when the cart changes, without rerunning when the user changes.

108. What is linkedSignal()?

linkedSignal creates a writable signal that resets when a source signal changes. For example, a selected option can default to the first item and reset when the list changes, but the user can still pick another. It has been stable since Angular 20.0.

109. What is the resource() API?

resource() loads async data into signals. You give it params, a function of other signals, and a loader that returns a promise. It exposes value(), status(), error() and isLoading(), and reloads when the params change.

110. What is httpResource?

httpResource is a resource that uses HttpClient under the hood. For example, user = httpResource(() => '/api/users/' + id()) fetches again when id changes. So interceptors still apply, and you get signals in place of an Observable.

111. What is rxResource?

rxResource is a resource whose loader returns an Observable. It helps when you have existing RxJS-based services. Like resource, it loads again when its params change.

112. Are resources stable now?

Yes. Angular 22 made the asynchronous signal APIs stable, which includes resource(), rxResource() and httpResource(). Earlier versions shipped them as experimental, so older blog posts may call them previews.

113. How do signals relate to RxJS?

Signals hold a current value and are synchronous. Observables model streams of events over time. So signals fit UI state, while RxJS still fits complex async flows like debounced search or websockets.

114. What do toSignal and toObservable do?

They come from @angular/core/rxjs-interop. toSignal(obs$) subscribes and exposes the latest value as a signal, with cleanup on destroy. toObservable(sig) turns a signal into an Observable that emits when it changes.

115. What does toSignal return before the first value?

It returns undefined unless you pass initialValue. If the Observable emits at once, such as a BehaviorSubject, pass { requireSync: true } to drop the undefined type.

116. How do signals help change detection?

When a template reads a signal, Angular knows that view depends on it. So when the signal changes, Angular marks only that view and its parents for checking. This is what makes zoneless apps possible.

117. What are signal queries?

viewChild(), viewChildren(), contentChild() and contentChildren() return signals with the query results. They update as the DOM changes. Also, viewChild.required() removes undefined from the type.

118. Can you write to a signal input?

No. Signal inputs from input() are read-only inside the component. If the child must change the value, use model() or emit an output and let the parent update it.

119. How do you compare objects in a signal?

Pass an equal function: signal(user, { equal: (a, b) => a.id === b.id }). Then setting a new object with the same ID does not notify readers. Use this to avoid extra updates.

120. Why should signal values be immutable?

Signals notify only when you call set or update with a value that differs by the equality check. If you push into an array in place and set the same array, nothing updates. So always return a new array or object.

121. What is a signal store?

A signal store is a state pattern built on signals, such as NgRx SignalStore. It groups state, computed values and methods in one injectable. It needs less code than classic NgRx with actions and reducers.

122. When would you still pick classic NgRx Store?

Pick it for large apps that need strict event logs, time-travel debugging and Redux DevTools across many teams. However, many new apps use SignalStore or plain services with signals. The choice depends on how many people change the same state.

123. What is the difference between computed and effect?

computed returns a value and has no side effects. effect returns nothing useful and exists for side effects. So if you are setting a signal inside an effect, a computed or linkedSignal is usually the right tool.

124. Do signals replace @Input and Observables completely?

Not completely. Decorator inputs still work, and RxJS is still part of Angular’s HTTP client and router. However, new APIs like signal inputs, queries, forms and resources point toward signals for UI state.

125. Why use a signal instead of a plain class field?

A plain field gives Angular no signal that it changed, so the view updates only if something else triggers a check. A signal tells Angular exactly which views read it. As a result, signals work with OnPush and zoneless apps, while plain fields often do not.

Change Detection, Zone.js and Performance

126. What is change detection?

Change detection is how Angular keeps the DOM in sync with component data. It checks bindings and updates the DOM where values changed. In zone-based apps, it runs after async events. In zoneless apps, it runs when signals or other notifiers say so.

127. What is Zone.js?

Zone.js patches browser async APIs such as setTimeout, Promise callbacks and DOM events. It tells Angular when an async task finishes, so Angular can run change detection. It was required in older Angular apps.

128. What is zoneless Angular?

Zoneless Angular runs without Zone.js. Change detection runs when a signal used in a template changes or an event handler runs. It also runs when code calls markForCheck() or the async pipe gets a value. Zoneless is the default for new apps since Angular 21.

129. How do you turn on zoneless in Angular 20?

Add provideZonelessChangeDetection() to the app providers and remove zone.js from the polyfills. Then fix code that relied on Zone.js, such as setting plain fields in a setTimeout. Use signals or markForCheck() for those updates.

130. What breaks when you remove Zone.js?

Code that changes plain class fields inside timers, async callbacks or third-party code stops updating the view. Also, NgZone.onStable and similar hooks no longer fire. Reactive form changes need markForCheck() or signals to show in OnPush views.

131. What is OnPush change detection?

With ChangeDetectionStrategy.OnPush, Angular checks a component only in a few cases. An input reference changes, an event fires inside it, a signal it reads changes, or code marks it for check. So large trees skip work.

132. What changed about OnPush in Angular 22?

In Angular 22, OnPush is the default for components that do not set a strategy. The old Default value is deprecated, and Eager is its new name. So when you upgrade, set Eager on components that still depend on plain mutable fields, or move them to signals.

133. What is the Eager strategy?

ChangeDetectionStrategy.Eager checks the component every time change detection reaches it. It is the same as the old Default. Use it only for components that depend on plain mutable fields, while you move them to signals.

134. What does markForCheck do?

ChangeDetectorRef.markForCheck() marks the component and its ancestors to be checked in the next cycle. You need it in OnPush or zoneless components when data changes outside signals. The async pipe calls it for you.

135. What is the difference between detectChanges and markForCheck?

detectChanges() runs change detection on the component and its children right away. markForCheck() only schedules a check. Prefer markForCheck or signals, and use detectChanges only in rare cases like tests.

136. What is runOutsideAngular?

In zone-based apps, NgZone.runOutsideAngular(fn) runs code without triggering change detection. For example, a mousemove handler for a canvas can run outside, then call run() only when the view must update. In zoneless apps it has no effect.

137. What is ExpressionChangedAfterItHasBeenCheckedError?

This dev-mode error means a binding changed after Angular checked it in the same cycle. It often comes from changing a parent value in a child’s ngAfterViewInit. Fix it by moving the logic earlier, using a signal, or deferring the change.

138. How do you make a long list fast?

Use @for with a good track expression so rows are reused. For thousands of rows, use the CDK virtual scroll viewport, which renders only visible items. Also keep row components on OnPush.

139. What is lazy loading?

Lazy loading downloads code for a route only when the user visits it. Use loadComponent: () => import('./admin') or loadChildren. As a result, the first bundle stays small.

140. What is the difference between lazy loading routes and @defer?

Lazy routes split code by page. @defer splits code inside a page, such as a heavy chart far down the page. Both cut the size of the first download.

141. What is preloading?

Preloading downloads lazy routes in the background after the app starts. Add withPreloading(PreloadAllModules) to provideRouter. You can also write a custom strategy that preloads only routes marked in their data.

142. How do you find what is slow in an Angular app?

Use the Angular DevTools profiler to see change detection time per component. Then use the Chrome Performance panel and Lighthouse for load time. Also check bundle size with ng build --stats-json and a bundle analyzer.

143. How does trackBy relate to track?

trackBy was the *ngFor way to give a function that returns an item’s identity. The @for block requires track, which can be a property like item.id. Both stop Angular from rebuilding every row on a new array.

144. What causes memory leaks in Angular apps?

Common causes are Observable subscriptions that never end, global event listeners and timers not cleared on destroy. Fix them with the async pipe, takeUntilDestroyed() and DestroyRef. Also watch services that keep growing arrays.

145. What is server-side rendering in Angular?

SSR renders pages on the server with @angular/ssr, so users and crawlers get HTML first. Then the browser hydrates it. Add it with ng add @angular/ssr or choose it in ng new.

RxJS and HttpClient Questions

146. What is an Observable?

An Observable is a stream that can emit many values over time, then complete or error. Nothing happens until something subscribes. Angular uses Observables for HTTP calls, router events and form value changes.

147. What is the difference between an Observable and a Promise?

A Promise gives one value and starts right away. An Observable can give many values, starts only on subscribe, and can be cancelled by unsubscribing. Also, Observables have operators for mapping, filtering and combining streams.

148. What is a Subject?

A Subject is both an Observable and an observer, so you can push values with next() to many subscribers. It is often used for events inside a service. Late subscribers do not get earlier values.

149. What are BehaviorSubject and ReplaySubject?

A BehaviorSubject needs a starting value and gives the latest value to new subscribers. A ReplaySubject replays a set number of past values. In new code, a signal often replaces a BehaviorSubject for state.

150. What is the difference between switchMap, mergeMap, concatMap and exhaustMap?

All four map each value to an inner Observable. switchMap cancels the previous inner one, which works for search. mergeMap runs them in parallel, concatMap runs them in order, and exhaustMap ignores new values while one is running, which works for a submit button.

151. How do you build a type-ahead search with RxJS?

results$ = this.query.valueChanges.pipe(
  debounceTime(300), distinctUntilChanged(),
  switchMap(q => this.api.search(q))
);

debounceTime waits for a pause in typing, distinctUntilChanged skips repeats, and switchMap drops old requests.

152. How do you unsubscribe safely?

Prefer the async pipe or toSignal, which clean up for you. For manual subscriptions, pipe through takeUntilDestroyed() from @angular/core/rxjs-interop. HTTP Observables complete on their own, but unsubscribing still cancels a slow request.

153. What is the difference between cold and hot Observables?

A cold Observable starts a new run for each subscriber, like an HTTP call that fires once per subscription. A hot Observable shares one source, like mouse events. Use shareReplay(1) to turn a cold HTTP call into a shared one.

154. Why can two subscriptions send two HTTP requests?

Each subscribe on an HttpClient Observable starts its own request. So using the async pipe twice on the same Observable calls the API twice. Fix it with shareReplay, a single @let in the template, or httpResource.

155. What do combineLatest and forkJoin do?

combineLatest emits whenever any source emits, after each has emitted once. forkJoin waits for all sources to complete, then emits their last values once. So use forkJoin for parallel HTTP calls and combineLatest for live filters.

156. How do you handle errors in an RxJS stream?

Use catchError to return a fallback Observable, such as of([]), or to rethrow with throwError. Put it inside switchMap if you want the outer stream to keep working after one failure. Also use retry for flaky calls.

157. How do you set up HttpClient?

Add provideHttpClient() to the app config. Then inject HttpClient and call get, post, put, patch or delete. Each returns an Observable of the response body by default.

158. How do you type an HTTP response?

Pass a type argument: http.get<User[]>('/api/users'). Note that this is only a compile-time hint. The server could still send something else, so validate important data at runtime.

159. How do you send query parameters and headers?

Pass an options object: http.get('/api/orders', { params: { page: 2 }, headers: { 'X-Tenant': 'in' } }). You can also build HttpParams and HttpHeaders objects. Both are immutable.

160. How do you read the full HTTP response?

Set observe: 'response' in the options. Then you get an HttpResponse with status, headers and body. Use observe: 'events' to track upload or download progress.

161. How do you handle HTTP errors globally?

Write an interceptor that uses catchError and checks HttpErrorResponse.status. For example, on 401 it can redirect to login, and on 500 it can show a toast. Then rethrow so the caller can react too.

162. How do you test HTTP calls?

Add provideHttpClient() and provideHttpClientTesting() to TestBed. Then inject HttpTestingController, call expectOne('/api/users'), and flush fake data. Finally call verify() to check that no extra requests were made.

163. What is the difference between retry and retryWhen?

retry(3) resubscribes up to three times after an error. retryWhen is deprecated in RxJS 7. Instead, pass a config like retry({ count: 3, delay: 1000 }) for delays.

164. What is a higher-order Observable?

It is an Observable that emits other Observables, such as a stream of HTTP calls. Flattening operators like switchMap and mergeMap subscribe to the inner ones for you. Without them, you end up with nested subscribes.

165. Why avoid nested subscribes?

Nested subscribe calls are hard to cancel and leak easily. They also hide errors from the outer stream. So use a flattening operator and one subscription, or the async pipe.

Angular Forms Questions: Template-Driven, Reactive and Signal Forms

166. What kinds of forms does Angular have?

Angular has template-driven forms, reactive forms and, since v22, stable signal forms. Template-driven forms use ngModel in the template. Reactive forms build the model in the class with FormGroup and FormControl, and signal forms build it from a signal.

167. When do you pick template-driven forms?

Pick them for small forms, such as a newsletter box or a login form. They need less code but are harder to test and change at runtime. Import FormsModule to use them.

168. What are reactive forms?

Reactive forms define the form structure in TypeScript with FormControl, FormGroup and FormArray. You bind them with [formGroup] and formControlName. They give you synchronous access to values and validity, which makes them easy to test.

169. What are typed reactive forms?

Since Angular 14, reactive forms are typed. So new FormControl('') has the type FormControl<string | null>. Use nonNullable: true or NonNullableFormBuilder to drop the null from reset values.

170. What is FormBuilder?

FormBuilder is a helper that shortens reactive form setup. For example, fb.group({ email: ['', Validators.required] }). Inject it with inject(FormBuilder).

171. How do you write a custom validator?

Write a function that takes a control and returns errors or null:

const noSpaces: ValidatorFn = c =>
  /\s/.test(c.value ?? '') ? { noSpaces: true } : null;

Then add it to the control’s validators array.

172. What is an async validator?

An async validator returns a Promise or Observable of errors. For example, it can check with the server that a username is free. Angular runs async validators only after the sync ones pass.

173. What is FormArray used for?

FormArray holds a dynamic list of controls, such as several phone numbers. You add and remove items with push and removeAt. In the template, loop over its controls with @for.

174. What are signal forms?

Signal forms build a form from a signal that holds the model. You call form(model, schema => { required(schema.email); }) and bind inputs with the [formField] directive. They come from @angular/forms/signals and became stable in Angular 22.

175. Show a minimal signal form.

loginModel = signal({ email: '', password: '' });
loginForm = form(this.loginModel, p => {
  required(p.email); email(p.email); required(p.password);
});

In the template, write <input [formField]="loginForm.email">. Each field exposes its value, validity and errors as signals.

176. What is ControlValueAccessor?

ControlValueAccessor is the interface that lets a custom component act like a form control. You implement writeValue, registerOnChange, registerOnTouched and optionally setDisabledState. Then the component works with ngModel and formControlName.

177. What do pristine, dirty, touched and untouched mean?

A control is pristine until the user changes its value, then it becomes dirty. It is untouched until the user leaves the field, then it becomes touched. Show error messages after touched, so users are not scolded before they type.

178. How do you show validation messages?

Check the control’s errors in the template, for example @if (email.touched && email.hasError('required')) { <p>Email is required</p> }. Link the message to the input with aria-describedby. Also check the data again on the server.

Angular Routing Questions

179. How do you set up routing?

Define a Routes array and pass it to provideRouter(routes). Then place <router-outlet /> where pages should render. Use routerLink on anchors to move between pages.

180. How do you read route parameters?

Inject ActivatedRoute and read paramMap, or bind them as inputs with withComponentInputBinding(). With input binding, a route users/:id sets an id input on the component. That way the component does not need the router at all.

181. What are route guards?

Guards decide if the user may enter or leave a route. Functional guards include CanActivateFn, CanActivateChildFn, CanDeactivateFn and CanMatchFn. A guard returns true, false or a UrlTree to redirect.

182. Write a simple auth guard.

export const authGuard: CanActivateFn = () =>
  inject(AuthService).isLoggedIn() || inject(Router).parseUrl('/login');

Add it to a route with canActivate: [authGuard]. Remember that the API must also check access.

183. What is the difference between canActivate and canMatch?

canActivate runs after the route matches and can block it. canMatch runs during matching, so a failed check lets the router try the next route. Also, canMatch stops a lazy route’s code from downloading at all.

184. What is a resolver?

A resolver loads data before the route activates. In modern Angular it is a ResolveFn function. Many teams now load data in the component with httpResource, so a skeleton appears quickly.

185. How do you change routes in code?

Inject Router and call navigate(['/orders', id]) or navigateByUrl('/orders/5'). Pass queryParams in the extras for query strings. Both return a promise that resolves to true when the route change succeeds.

186. What are child routes?

Child routes render inside a parent component’s own <router-outlet>. For example, settings can have profile and billing children. The parent keeps shared layout like tabs.

187. How do you add a 404 page?

Add a wildcard route at the end: { path: '**', component: NotFound }. The router matches routes in order, so the wildcard must come last. Also set the HTTP status in SSR, so search engines see a real 404.

188. What is the title strategy in the router?

Each route can have a title property. The router sets the page title when the route activates. For custom formats, extend TitleStrategy, for example to add the app name to every title.

Testing, SSR and Build Questions

189. Which test runner do new Angular projects use?

New projects since Angular 21 use Vitest as the default unit test runner. Older projects often use Karma with Jasmine. Also, angular.dev has a guide for moving an existing project from Karma to Vitest.

190. What is TestBed?

TestBed creates a small Angular environment for a test. You configure imports and providers, then call createComponent to get a ComponentFixture. The fixture gives you the component instance and its DOM.

191. How do you test a component with an input?

Create the fixture and set the input with fixture.componentRef.setInput('name', 'Ravi'). Then await fixture.whenStable() and check the DOM. setInput works with both signal and decorator inputs.

192. What are fakeAsync and tick?

fakeAsync runs a test in a fake async zone, and tick(ms) moves time forward. So you can test a debounce without waiting. They depend on Zone.js, so zoneless tests often use Vitest’s fake timers instead.

193. What do CDK test helpers for components do?

The CDK testing package gives each component a test API class. For example, MatButtonHarness lets you click a Material button without knowing its DOM. Tests stay stable when the inner markup changes.

194. Which end-to-end tools work with Angular?

Protractor reached its end of life in 2023. Today teams use Playwright or Cypress, and ng e2e can be set up with either. They test real user flows in a browser.

195. What is hydration in Angular?

Hydration reuses server-rendered DOM on the client, instead of throwing it away and rendering again. Enable it with provideClientHydration(). This avoids flicker and improves Core Web Vitals.

196. What is incremental hydration?

Incremental hydration keeps parts of the page dehydrated until a trigger fires, using @defer blocks with hydrate on triggers. For example, @defer (hydrate on viewport) hydrates a section when it scrolls into view. So less JavaScript runs at start.

197. What is event replay?

Event replay records clicks that happen before hydration finishes and replays them after. So a user who taps an Add to cart button early does not lose the action. It is turned on with withEventReplay().

198. How do you avoid browser-only code breaking SSR?

Do not touch window or document during server rendering. Put browser code in afterNextRender, or check isPlatformBrowser(inject(PLATFORM_ID)). Also inject DOCUMENT from @angular/core in place of the global.

199. How would you upgrade an app from v15 to v22?

Go one major at a time with ng update @angular/core@16 @angular/cli@16, then 17, and so on. Check the steps on angular.dev/update for each hop and run tests after each. Plan for big changes at v17 (control flow and builder), v19 (standalone default) and v22 (OnPush default).

200. A screen does not update after data arrives in a zoneless app. What do you check?

First, check if the data is set on a plain field inside a callback. If so, move it into a signal or call markForCheck(). Next, check if a component got OnPush by default in v22 and mutates input objects in place, then replace them with new objects.

Read also: 100 Database Questions for Interview

Mistakes That Cost Candidates Angular Offers

Interviewers hear the same weak spots again and again. So check your answers against this list before the round.

  • Answering with old defaults. Saying every component needs an NgModule, or that Zone.js always runs change detection, dates you to Angular 14 or earlier.
  • Mixing up OnPush and immutability. OnPush compares input references, so mutating an array in place hides the change.
  • Subscribing inside subscribe. Live coding rounds often include a search box, and nested subscribes there are an instant red flag.
  • Not knowing your own version. If your project runs Angular 16, say so, and explain what you would change on an upgrade.
  • No tests in the take-home. Even two TestBed tests show that you know the tooling.

Also, keep one project ready to walk through, with its folder layout and state approach. If the role involves content sites, it helps to know how a CMS plugs in. For that, see the guides on the best CMS for Angular and the best CMS for an Nx workspace.

Angular signal forms page on angular.dev with a login form code example
Screenshot: angular.dev

Angular Job Seekers Also Ask

Is Angular still worth learning for jobs in India?

Yes. Angular remains common in banking, insurance, telecom and IT service firms, where apps are large and long-lived. Many of these roles also want Java or .NET on the back end, so a full-stack profile helps.

Should I learn AngularJS for interviews?

Only if the job post names AngularJS. Some legacy apps still run it, but it reached end of support in 2021. For most roles, modern Angular with signals is what gets tested.

How many applications does it take to land an Angular role?

It varies by city, level and market. On average, job seekers send many applications per offer, so track yours and tune your résumé as you go. This breakdown of the average number of job applications before getting hired shows typical numbers.

Do I need to know NgRx?

Know what it is and when it helps. Many teams now use NgRx SignalStore or services with signals. If the job ad names NgRx, be ready to explain actions, reducers, effects and selectors.

Joydeep Bhattacharya Avatar

Written by

Founder, Editor and Business Reporter, Bizolaunch

Free Tools for Founders

Calculators and templates built by Bizolaunch. Run the numbers in minutes.

Keep Reading