Bird
0
0

You wrote a custom preloading strategy but modules never preload. What is a likely cause?

medium📝 Debug Q6 of 15
Angular - Performance Optimization
You wrote a custom preloading strategy but modules never preload. What is a likely cause?
AYou forgot to provide the strategy in RouterModule.forRoot.
BYou used PreloadAllModules instead of your custom strategy.
CYou set preloadingStrategy to NoPreloading.
DYou imported RouterModule without routes.
Step-by-Step Solution
Solution:
  1. Step 1: Check how custom strategy is registered

    Custom strategies must be provided in RouterModule.forRoot's preloadingStrategy option.
  2. Step 2: Identify missing provider

    If you forget to set preloadingStrategy to your custom class, Angular won't use it.
  3. Final Answer:

    You forgot to provide the strategy in RouterModule.forRoot. -> Option A
  4. Quick Check:

    Custom strategy must be set in forRoot [OK]
Quick Trick: Always set your custom strategy in forRoot preloadingStrategy [OK]
Common Mistakes:
  • Not providing custom strategy in router config
  • Using NoPreloading by mistake
  • Forgetting to import RouterModule with routes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes