mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
ae0a63ad48
Extracting preloading to a provider moves us towards thinking about a world where `ExtraOptions` doesn't exist to control behaviors that are opt-in/opt-out. Instead, these behaviors could be controlled by the presence (or lackthereof) of the providers which has the functionality. This is relevant to a world in which we no longer have the `RouterModule` but instead have something like `provideRouter` where the features are tree-shakeable. This change _does not_ make the `RouterPreloader` tree-shakeable inside `RouterModule.forRoot` because the compiler cannot statically determine whether it's needed. However, in the `provideRouter` world without `forRoot`, preloading could be exposed through the provider function instead, making the `RouterPreloader` and `PreloadingStrategy` implementations tree-shakeable for those that don't use it (which is the default - no preloading). PR Close #46215