Angular - Performance OptimizationWhy might some unused Angular code still be included in the final bundle after tree shaking?ABecause Angular does not support tree shakingBBecause the code has side effects or is referenced indirectlyCBecause the code is written in TypeScriptDBecause the app uses lazy loadingCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand tree shaking limitationsCode with side effects or indirect references cannot be safely removed.Step 2: Eliminate incorrect optionsAngular supports tree shaking; TypeScript usage does not prevent it; lazy loading reduces bundle size but doesn't cause unused code inclusion.Final Answer:Because the code has side effects or is referenced indirectly -> Option BQuick Check:Side effects prevent safe removal by tree shaking [OK]Quick Trick: Side effects keep unused code in bundles [OK]Common Mistakes:Thinking Angular lacks tree shaking supportBlaming TypeScript for bundle sizeConfusing lazy loading with tree shaking
Master "Performance Optimization" in Angular9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Angular Quizzes Advanced Patterns - Facade service pattern - Quiz 9hard Angular Signals - Effect for side effects - Quiz 1easy Angular Signals - Why signals are introduced - Quiz 3easy Internationalization and Accessibility - Locale switching - Quiz 2easy Performance Optimization - Lazy loading routes and modules - Quiz 15hard Server-Side Rendering - Pre-rendering static pages - Quiz 15hard Standalone Components - Bootstrapping with standalone - Quiz 14medium State Management - Why state management matters - Quiz 6medium State Management - Service-based state management - Quiz 13medium Testing - Testing with fixtures and debug elements - Quiz 6medium