Angular - Change DetectionWhat happens if a component with OnPush change detection updates an internal variable but its input reference stays the same?AAngular will throw an error about change detection.BAngular will NOT run change detection for that component automatically.CAngular will always run change detection regardless of input changes.DAngular will update the view immediately.Check Answer
Step-by-Step SolutionSolution:Step 1: Recall OnPush detection rulesOnPush only runs change detection when input references change or events inside the component occur.Step 2: Understand internal variable effectChanging internal variables without input change does not trigger detection automatically.Final Answer:Angular will NOT run change detection for that component automatically. -> Option BQuick Check:OnPush ignores internal variable changes [OK]Quick Trick: Internal changes don't trigger OnPush detection [OK]Common Mistakes:MISTAKESAssuming internal changes always update viewExpecting errors on internal changesBelieving OnPush ignores input changes
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