Recall & Review
beginner
What is the purpose of preloading strategies in Angular routing?
Preloading strategies help load lazy-loaded modules in the background after the app starts, improving user experience by reducing wait times when navigating.
Click to reveal answer
beginner
Name the two built-in preloading strategies Angular provides.
Angular provides NoPreloading (default, no modules preloaded) and PreloadAllModules (all lazy modules preload after app start).
Click to reveal answer
beginner
How do you enable the
PreloadAllModules strategy in Angular?In the RouterModule.forRoot() method, pass
{ preloadingStrategy: PreloadAllModules } as the second argument.Click to reveal answer
intermediate
What is a custom preloading strategy in Angular?
A custom preloading strategy is a user-defined service implementing the
PreloadingStrategy interface to control which modules preload based on custom logic.Click to reveal answer
intermediate
Why might you choose a custom preloading strategy over the built-in ones?
To preload only specific modules based on conditions like user roles, network speed, or app state, optimizing performance and resource use.
Click to reveal answer
Which Angular preloading strategy loads all lazy modules immediately after app start?
✗ Incorrect
PreloadAllModules loads all lazy modules in the background after the app starts, improving navigation speed.
What is the default preloading strategy in Angular routing?
✗ Incorrect
NoPreloading is the default, meaning lazy modules load only when the user navigates to them.
How do you specify a preloading strategy in Angular routing configuration?
✗ Incorrect
You set the preloading strategy by passing { preloadingStrategy: ... } to RouterModule.forRoot().
What interface must a custom preloading strategy implement?
✗ Incorrect
Custom preloading strategies implement the PreloadingStrategy interface to define preload behavior.
Which scenario best fits using a custom preloading strategy?
✗ Incorrect
Custom strategies allow preloading modules selectively, such as based on user permissions or network conditions.
Explain what preloading strategies are in Angular and why they matter.
Think about how apps load parts in the background to be ready faster.
You got /3 concepts.
Describe how to implement a custom preloading strategy in Angular.
Focus on the interface and where to configure it.
You got /3 concepts.