DevPrep
  • Interview Prep
  • Projects
  • Resources
  • Pricing
  • About Us
Submit Question
DevPrep
  • Pricing
  • About Us
Submit Question
  1. Home
  2. Articles
  3. Frontend Engineering
  4. Angular Interview Questions, Answered Through Change Detection
XLinkedInReddit
MediumFrontend Engineering

Angular Interview Questions, Answered Through Change Detection

Thirteen questions that go past the decorators: what triggers a check, what OnPush really skips, why signals are more precise, and how to diagnose a list that scrolls badly.

R
rahulrana1
8 min read·1
Table of Contents
  • Fundamentals
  • 1. What is a component, really?
  • 2. Standalone components or NgModules?
  • 3. What is dependency injection buying you here?
  • Change detection, which is the real subject
  • 4. What makes Angular check a component?
  • 5. What does OnPush actually change?
  • 6. What problem do signals solve that OnPush does not?
  • 7. Signals or RxJS?
  • Forms, routing and the things that get asked next
  • 8. Template-driven or reactive forms?
  • 9. What is a route guard for, and what is it not for?
  • 10. Why is the bundle so large, and what do you do about it?
  • Questions for senior and staff candidates
  • 11. A list of two thousand rows scrolls badly. Walk me through it.
  • 12. How do you stop a component from leaking subscriptions?
  • 13. How would you migrate a large application to signals?
  • How to prepare
  • Sources
The short answer
Angular interviews have changed. The questions about NgModule and *ngIf still get asked, but the ones that decide the offer are about change detection, signals and why a page is slow. If you can explain what triggers a check and what stops one, most of the rest follows.

Angular is a large framework and candidates often prepare by memorising its surface: decorators, lifecycle hooks, module metadata. That preparation answers the first fifteen minutes of an interview and runs out exactly when it starts to matter, because the interesting questions are about the runtime, not the API.

This is organised from the fundamentals outward. The later sections assume nothing extra, they just go deeper into the same machinery.

Fundamentals

1. What is a component, really?

A class with a template and a piece of state, registered with the framework so that Angular can create it, give it dependencies, render it, and destroy it. Saying that is fine. The follow-up is where candidates separate: what does Angular do between creating it and rendering it?

It resolves the constructor's dependencies from the injector, runs the constructor, sets the inputs, then runs the first change detection pass, which is when ngOnInit fires. That ordering explains a bug people hit constantly: inputs are not available in the constructor, because they have not been set yet. Work that depends on an input belongs in ngOnInit or in a setter.

2. Standalone components or NgModules?

Standalone, for anything new. A standalone component declares its own imports, so what it depends on is visible in the file rather than in a module several directories away. Modules remain in older codebases and the two interoperate, so migrating is incremental rather than a rewrite.

The useful thing to add: the reason modules existed was to tell the compiler which directives are in scope for a template, and standalone components answer that question locally instead. Framing it that way shows you know what problem the old design was solving.

3. What is dependency injection buying you here?

Substitutability and lifetime management. Angular's injector is hierarchical: a service provided in root is a singleton for the application, while one provided on a component is created per instance of that component and destroyed with it.

// One instance, application-wide. Lives until the app does.
@Injectable({ providedIn: 'root' })
export class AuthService {}

// One instance per PanelComponent. Dies with the panel.
@Component({
  selector: 'app-panel',
  providers: [PanelState],
  template: `...`,
})
export class PanelComponent {}

The question underneath is about leaks: state you put in a root service outlives every page that used it, which is correct for a session and wrong for a form.

Change detection, which is the real subject

4. What makes Angular check a component?

Something asynchronous finished. Angular patches the browser's async APIs, so a click handler, a timer, or an HTTP response all tell the framework that state may have changed, and it walks the component tree checking bindings.

The important part is the shape of the walk: by default it checks every component on every pass. On a small page that is free. On a page with a few thousand bindings it is the reason scrolling stutters.

5. What does OnPush actually change?

skipped unless markedchecked every passAppComponentDefaultListComponentOnPushRowComponentRowComponentSidebarComponentDefault
With OnPush, a subtree is skipped unless something marks it. The saving is the subtree, not the component.

With OnPush, Angular skips a component and everything below it unless one of a few things happened: an input changed by reference, an event fired from its own template, an async pipe in its template emitted, or something called markForCheck() explicitly.

The trap this creates
"Changed by reference" is the whole catch. Pushing onto an array that is bound as an input does not change the reference, so an OnPush component will not re-render and the bug looks like Angular is broken. The fix is to replace the array rather than mutate it. This is the single most common OnPush question, and the answer interviewers want is the word reference, not the word immutable.

6. What problem do signals solve that OnPush does not?

Precision. OnPush narrows the work to a subtree; a signal narrows it to the bindings that actually read the value. The framework knows which template expressions depend on which signal, so a change can update those and nothing else, rather than re-checking a component because something somewhere in it might have changed.

@Component({
  selector: 'app-cart',
  template: `
    <p>{{ count() }} items, {{ total() }} total</p>
    <button (click)="add()">Add</button>
  `,
})
export class CartComponent {
  items = signal<Item[]>([]);

  // Recomputed only when items changes, and only if something reads it.
  count = computed(() => this.items().length);
  total = computed(() =>
    this.items().reduce((sum, i) => sum + i.price, 0)
  );

  add() {
    // A new array: the signal notifies, and only the two bindings
    // above are updated.
    this.items.update((current) => [...current, newItem()]);
  }
}

The nuance worth volunteering: a computed is lazy and cached. It does not recompute when its input changes, it recomputes the next time something reads it, and only if an input actually changed. That is why putting a side effect inside a computed is a mistake, and why effect exists.

7. Signals or RxJS?

They answer different questions, and an interviewer asking this is usually checking whether you will say "signals replace RxJS", which is wrong. Signals model a value that exists now. RxJS models a sequence of events over time, with operators for the hard parts: debouncing a search box, cancelling an in-flight request when a new one starts, retrying with backoff.

Where people get stuck
Answering "signals replace RxJS". They do not, and the interviewer usually has a follow-up ready to prove it: how would you debounce a search box and cancel the previous request with signals alone? The answer is that you would not, you would use RxJS for that stream and hold the result in a signal. The sensible position is signals for component state, RxJS for event streams and asynchronous coordination, and conversion at the boundary rather than a rule that one must win.

Forms, routing and the things that get asked next

8. Template-driven or reactive forms?

Reactive for anything with real validation, because the form model is an object you can test without rendering anything. Template-driven is less code for a login box with two fields, and that is a legitimate choice rather than a mistake.

The follow-up that catches people: a custom validator that calls a server must be an async validator, and async validators do not run until the synchronous ones pass. That ordering is deliberate, and it is why "my uniqueness check never fires" is usually a required-field error elsewhere in the form.

9. What is a route guard for, and what is it not for?

It decides whether navigation may proceed. It is not a security boundary. A guard runs in the browser, in code the user controls, so it improves the experience and protects nothing. The server must authorise every request regardless of what the guard decided.

Candidates who say that unprompted are telling you they have thought about where trust lives.

10. Why is the bundle so large, and what do you do about it?

Find out before acting. Build with the stats output and look at what is actually in there. In practice the answers are usually: a date or utility library imported whole for one function, an icon set imported whole for six icons, or a feature that should be lazily routed and is eagerly imported by something shared.

Lazy loading by route is the structural fix, and the thing that defeats it is a shared module that imports everything, which pulls the lazy chunks back into the main bundle.

Questions for senior and staff candidates

11. A list of two thousand rows scrolls badly. Walk me through it.

Rendering two thousand components is the problem, and no amount of change detection tuning fixes it, because the DOM nodes exist either way. The structural answer is virtual scrolling: render the visible window and recycle.

Then the second-order fixes, in order of value: trackBy so the framework reuses DOM nodes instead of destroying and recreating them on every update, OnPush on the row component, and moving any formatting out of the template into a pure pipe or a precomputed field, because an expression in a template runs on every check.

12. How do you stop a component from leaking subscriptions?

Prefer not to subscribe manually. The async pipe subscribes and unsubscribes with the component's lifetime, which removes the class of bug entirely. Where you must subscribe in code, the modern answer is takeUntilDestroyed, which ties the subscription to the injection context rather than to a hand-written ngOnDestroy you can forget.

The reason this gets asked: a leaked subscription on a route you navigate in and out of is invisible in development and compounds in production.

13. How would you migrate a large application to signals?

Incrementally, and the credible answer names a seam. Signals interoperate with what you already have, so you can convert a leaf component's internal state without touching its parent, and convert shared state behind a service's public API without changing its consumers. Converting the shared state first is the mistake, because every consumer changes at once.

The honest framing is that the benefit is uneven: components with heavy templates and frequently-changing state gain a lot, and a form with four fields gains nothing measurable. A migration plan that starts with the measurably slow screens is a better answer than one that starts with the easy ones.

How to prepare

Build one page deliberately badly. A long list with default change detection, no trackBy, and a method call in the template. Profile it, then fix one thing at a time and watch the numbers move. An afternoon of that teaches change detection better than any explanation, and gives you a specific story to tell when the slow-page question comes.

Then read the signals guide end to end. It is short, it is current, and signals are where the newer questions come from.

Sources

  • Angular, Signals guide - signal, computed and effect semantics
  • Angular, Component lifecycle - hook ordering and when inputs are set
  • Angular, Hierarchical injectors - provider scope and lifetime
  • Angular, Components guide - standalone components and template scope

Related Articles

MediumFrontend Engineering

System Design #12: Design a Multi-Step Form Wizard

7 min read
MediumFrontend Engineering

Mastering Senior-Level JavaScript Interview Concepts

2 min read
MediumFrontend Engineering

System Design #9: Design a Collaborative Text Editor

9 min read

Comments (0)

Sign in to leave a comment.

No comments yet. Be the first to comment.

Table of Contents

  • Fundamentals
  • 1. What is a component, really?
  • 2. Standalone components or NgModules?
  • 3. What is dependency injection buying you here?
  • Change detection, which is the real subject
  • 4. What makes Angular check a component?
  • 5. What does OnPush actually change?
  • 6. What problem do signals solve that OnPush does not?
  • 7. Signals or RxJS?
  • Forms, routing and the things that get asked next
  • 8. Template-driven or reactive forms?
  • 9. What is a route guard for, and what is it not for?
  • 10. Why is the bundle so large, and what do you do about it?
  • Questions for senior and staff candidates
  • 11. A list of two thousand rows scrolls badly. Walk me through it.
  • 12. How do you stop a component from leaking subscriptions?
  • 13. How would you migrate a large application to signals?
  • How to prepare
  • Sources

Series

View all Frontend Engineering articles →

Practice

  • JavaScript
  • DSA
  • Machine Coding
  • System Design

Resources

  • Learning Tracks
  • Articles
  • Roadmaps
  • Compare Concepts
  • Glossary
  • Developer Tools
  • All Questions

Company

  • About
  • Pricing

Legal

  • Privacy Policy
  • Terms of Service
DevPrep

© 2026 DevPrep. All rights reserved.