Angular - Performance OptimizationWhy does Angular's OnPush change detection strategy improve performance compared to Default?AIt disables change detection completelyBIt runs change detection only when input references changeCIt runs change detection more frequentlyDIt forces Angular to reload components on every eventCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand OnPush detection triggerOnPush triggers detection only when input object references change.Step 2: Compare with Default strategyDefault runs detection on every event, causing more work.Final Answer:It runs change detection only when input references change -> Option BQuick Check:OnPush = detection on input reference change only [OK]Quick Trick: OnPush triggers detection only on input reference changes [OK]Common Mistakes:Thinking OnPush disables detectionBelieving OnPush runs detection more oftenAssuming OnPush reloads components every event
Master "Performance Optimization" in Angular9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Angular Quizzes Angular Signals - Signal-based components - Quiz 13medium Angular Signals - Effect for side effects - Quiz 6medium Animations - Keyframe animations - Quiz 9hard Animations - Trigger and state definitions - Quiz 10hard Animations - Animate method for timing - Quiz 2easy Performance Optimization - Virtual scrolling for large lists - Quiz 14medium Standalone Components - Importing dependencies directly - Quiz 14medium Standalone Components - Standalone component declaration - Quiz 12easy Standalone Components - Standalone pipes and directives - Quiz 8hard Testing - Testing HTTP calls with HttpTestingController - Quiz 6medium