Angular interviews cover dependency injection, RxJS, change detection, and TypeScript — the framework is opinionated, so questions test whether you understand its machinery. Below are the most common with model answers. Senior: architecture, trade-offs, mentoring, and decision-making.
Topics to prepare
✓Dependency Injection
✓RxJS and Observables
✓Change Detection
✓Modules and components
✓Reactive forms
✓TypeScript
6 Senior-level questions with answers
1
Explain change detection. How does OnPush differ from Default?
Answer
Change detection walks the component tree after events, timers, or HTTP responses and re-renders whatever bindings changed. Default checks every component on every cycle. OnPush checks a component only when an input reference changes, an event fires inside it, or an async pipe emits — which is why OnPush requires immutable data: mutating an object in place does not change its reference and the view will not update.
2
What are map, switchMap and mergeMap? What is the difference?
Answer
map transforms each emitted value. switchMap and mergeMap flatten an inner observable: switchMap cancels the previous inner subscription when a new value arrives, mergeMap runs them all concurrently. Use switchMap for search or navigation where only the latest result matters, mergeMap when every request must complete — and concatMap when order matters.
3
What is ngOnInit and how does it differ from the constructor?
Answer
The constructor runs when the class is instantiated, before Angular has set any input bindings, so inputs are still undefined there. ngOnInit runs after the first binding pass, which is why initialisation that depends on inputs belongs there. The convention is that constructors only receive injected dependencies and ngOnInit does the actual setup work.
4
What is the difference between template-driven and reactive forms?
Answer
Template-driven forms build the model implicitly from directives in the template and suit simple cases. Reactive forms define a FormGroup in the component class, which makes validation, dynamic controls, and testing explicit and type-safe. Reactive is the default recommendation for anything beyond a login form, because the form state lives in code where you can reason about it.
5
How do you avoid memory leaks with Observables?
Answer
A subscription that is never closed keeps its callback and captured scope alive after the component is destroyed. The cleanest solution is the async pipe, which subscribes and unsubscribes automatically. Otherwise use takeUntilDestroyed, or collect subscriptions and unsubscribe in ngOnDestroy — the common failure is a long-lived stream such as a router event or a websocket.
6
What is a pipe? How do you create a custom one?
Answer
A pipe transforms a value for display in a template, keeping formatting out of the component class. You create one with the @Pipe decorator and a transform method. Pipes are pure by default, meaning Angular re-evaluates them only when the input reference changes, which keeps them cheap — marking a pipe impure runs it on every change detection cycle and should be a last resort.
🦎
Reading answers is not enough
In a real interview you speak under pressure. Cam asks these same questions, scores every answer, and shows exactly what to fix.