Angular - Change DetectionWhy might OnPush change detection cause a component to not update even though data changed internally?ABecause OnPush disables all change detection for performance.BBecause Angular requires manual calls to detectChanges() always with OnPush.CBecause OnPush only checks for input reference changes or events inside the component.DBecause OnPush only works with primitive input types.Check Answer
Step-by-Step SolutionSolution:Step 1: Understand OnPush detection triggersOnPush runs detection only on input reference changes or internal events.Step 2: Explain internal data change effectInternal changes without input reference change or event do not trigger detection automatically.Final Answer:Because OnPush only checks for input reference changes or events inside the component. -> Option CQuick Check:OnPush updates only on input ref or events [OK]Quick Trick: OnPush ignores internal changes without input ref change [OK]Common Mistakes:MISTAKESThinking OnPush disables detectionBelieving manual detectChanges() always neededAssuming OnPush only works with primitives
Master "Change Detection" in Angular9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Angular Quizzes Angular Change Detection - Default change detection strategy - Quiz 8hard HTTP Client - Handling HTTP errors - Quiz 15hard HTTP Client - Loading states and error patterns - Quiz 11easy Routing - RouterLink for navigation - Quiz 15hard Routing - Query parameters and fragments - Quiz 7medium RxJS Operators - combineLatest and forkJoin for combining - Quiz 4medium RxJS Operators - map operator for transformation - Quiz 9hard Services and Dependency Injection - Singleton service behavior - Quiz 5medium Services and Dependency Injection - How dependency injection works in Angular - Quiz 6medium Template-Driven Forms - Two-way binding in forms - Quiz 6medium