Bird
0
0

You want to preload only the 'admin' module but not the 'user' module in your Angular app. Which approach correctly implements this custom preloading strategy?

hard📝 Application Q15 of 15
Angular - Performance Optimization
You want to preload only the 'admin' module but not the 'user' module in your Angular app. Which approach correctly implements this custom preloading strategy?
ASet preloadingStrategy to NoPreloading and preload 'admin' module eagerly
BUse PreloadAllModules and then lazy load 'user' module manually
CCreate a class implementing PreloadingStrategy that preloads only routes with data.preload = true
DMark 'admin' module as eager loaded and 'user' as lazy loaded without preloading
Step-by-Step Solution
Solution:
  1. Step 1: Understand custom preloading strategy

    Angular allows creating a class implementing PreloadingStrategy to control which modules preload.
  2. Step 2: Use route data property to select modules

    By checking data.preload flag in routes, the strategy can preload only selected modules like 'admin'.
  3. Final Answer:

    Create a class implementing PreloadingStrategy that preloads only routes with data.preload = true -> Option C
  4. Quick Check:

    Custom strategy uses data.preload flag [OK]
Quick Trick: Use data.preload flag with custom PreloadingStrategy [OK]
Common Mistakes:
  • Using PreloadAllModules when selective preload is needed
  • Trying to preload modules eagerly without strategy
  • Confusing eager loading with preloading

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes