Bird
0
0

What is the best way to combine lazy loading and OnPush change detection to enhance performance in a large Angular application?

hard📝 Conceptual Q8 of 15
Angular - Performance Optimization
What is the best way to combine lazy loading and OnPush change detection to enhance performance in a large Angular application?
ADisable lazy loading and use Default change detection for faster initial load
BUse OnPush change detection globally and avoid lazy loading
CLazy load modules but keep Default change detection for all components
DLazy load feature modules and set their components to use OnPush change detection
Step-by-Step Solution
Solution:
  1. Step 1: Understand lazy loading

    Lazy loading defers loading modules until needed, reducing initial load time.
  2. Step 2: Understand OnPush

    OnPush reduces change detection cycles improving runtime performance.
  3. Step 3: Combine both

    Lazy load modules and apply OnPush in their components for optimal performance.
  4. Final Answer:

    Lazy load feature modules and set their components to use OnPush change detection -> Option D
  5. Quick Check:

    Combine lazy loading with OnPush for best performance [OK]
Quick Trick: Lazy load modules + OnPush components = optimal performance [OK]
Common Mistakes:
  • Using OnPush globally without lazy loading
  • Lazy loading without OnPush components
  • Disabling lazy loading for faster load

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes