linkedin-skill-assessments-quizzes
linkedin-skill-assessments-quizzes copied to clipboard
Add an answer to Angular Q55
Q55. What is the purpose of the preloadingStrategy property configuration in this router code?
RouterModule.forRoot (
...
{
preloadingStrategy: PreloadAllModules
}
)
- [ ] It enables the option to flag individual routes for preloading.
- [ ] It preloads all dependencies for routes, creating instances of services when the app first starts up
- [ ] It ensures all modules get built into a single app module bundle file.
- [ ] It configures the router to immediately load all routes that have a loadChildren property (routes that are typically loaded when requested)
How angular.io official documentation described PreloadAllModules
:
Provides a preloading strategy that preloads all modules as quickly as possible.
How PreloadAllModules
explained in this document:
Angular provides built-in PreloadAllModules
strategy that loads all feature modules as quickly as possible configured with loadChildren
in application routing module.
Therefore I have a doubt which option is the answer.
Hey,
I've look over all these articles. I believe the answer is D "It configures the router to immediately load all routes that have a loadChildren property (routes that are typically loaded when requested)"
Because, The default behavior is Load on Demand (as stated in the parenthetical on the response); It does, in fact, load all the routes that have configured with the loadChildren statement; It do not find anything indicating that instances of services are automatically created.
- https://angular.io/api/router/PreloadAllModules
- https://www.tektutorialshub.com/angular/angular-preloading-strategy/
- https://web.dev/route-preloading-in-angular/
- https://www.concretepage.com/angular-2/angular-custom-preloading-strategy#Preloading
- https://www.johnpapa.net/preload-all-angular-bundles/
- https://medium.com/geekculture/preloading-strategy-in-angularsave-loading-time-ca791074fe28
PS: I sent a PR. Please let me know if I need to change how I did anything. Peace!