What is the difference between ChangeDetectionStrategy.Default and ChangeDetectionStrategy.OnPush in Angular?
WHAT IT TESTS: Angular change detection and subtree skipping. ANSWER OUTLINE: Default checks components on most async events; OnPush checks on input changes, DOM events, or async pipe emits. RED FLAG: OnPush is not a free switch; it requires immutable data.
WHAT IT TESTS: Whether you understand Angular's change detection tree and can identify when a subtree can safely skip dirty checks. ANSWER OUTLINE: Default runs checks on every component after most async events, timers, or HTTP calls, which is costly in deep trees. OnPush limits checks to three triggers: an input reference changes, a DOM event fires inside the component, or an async pipe emits. RED FLAG: Claiming OnPush is a performance toggle that works without immutable data, or saying it disables two-way binding.
Read the original → interview
- #angular
- #change-detection
- #onpush
- #performance
- #components
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.