docs(router): fix grammar typo in preloader section (#2700)

tweaks some other related language.
This commit is contained in:
Ward Bell 2016-10-31 01:17:27 -07:00 committed by GitHub
parent 32f3ed973d
commit 8a3d061305
1 changed files with 12 additions and 11 deletions

View File

@ -2148,20 +2148,20 @@ h3#preloading <i>Pre-Loading</i>: background loading of feature areas
* No pre-loading at all which is the default. Lazy loaded feature areas are still loaded on demand. * No pre-loading at all which is the default. Lazy loaded feature areas are still loaded on demand.
* Pre-loading of all lazy loaded feature areas. * Pre-loading of all lazy loaded feature areas.
The *Router* also supports [custom preloading strategies](#custom-preloading) to give us control of what we want to pre-load. The *Router* also supports [custom preloading strategies](#custom-preloading) for fine control over which modules to pre-load.
We'll update our *CrisisCenterModule* to be loaded lazily by default and use the `PreloadAllModules` strategy to eagerly We'll update our *CrisisCenterModule* to be loaded lazily by default and use the `PreloadAllModules` strategy
it up. to load _all_ lazy loaded modules as soon as possible.
<a id="preload-canload"></a> <a id="preload-canload"></a>
.l-sub-section .l-sub-section
:marked :marked
The **PreloadAllModules** strategy does not eagerly load feature areas protected by the [Can Load](#can-load-guard) and this is by design. The **PreloadAllModules** strategy does not load feature areas protected by a [CanLoad](#can-load-guard) guard and this is by design.
The *CanLoad* guard protects against loading feature area assets until authorized to do so. If you want to eagerly load all modules and guard The *CanLoad* guard blocks loading of feature module assets until authorized to do so. If you want to both preload a module and guard
them against unauthorized access, use the [CanActivate](#can-activate-guard) guard instead. against unauthorized access, use the [CanActivate](#can-activate-guard) guard instead.
:marked :marked
We'll update our route configuration to eagerly load the *CrisisCenterModule*. We follow the same process as we did when we loaded the *AdminModule* asynchronously. We'll update our route configuration to lazy load the *CrisisCenterModule*. We follow the same process as we did when we loaded the *AdminModule* asynchronously.
In the *crisis-center-routing.module.ts*, we'll change the *crisis-center* path to an *empty path* route. In the *crisis-center-routing.module.ts*, we'll change the *crisis-center* path to an *empty path* route.
We'll move our redirect and *crisis-center* route to our `AppRoutingModule` routes and use the `loadChildren` string to load the *CrisisCenterModule*. We'll move our redirect and *crisis-center* route to our `AppRoutingModule` routes and use the `loadChildren` string to load the *CrisisCenterModule*.
@ -2169,7 +2169,7 @@ h3#preloading <i>Pre-Loading</i>: background loading of feature areas
Once we're finished, we'll remove the `CrisisCenterModule` from our `AppModule`'s imports. Once we're finished, we'll remove the `CrisisCenterModule` from our `AppModule`'s imports.
Here are our updated modules: Here are the updated modules _before enabling preload_:
+makeTabs( +makeTabs(
`router/ts/app/app.module.ts, `router/ts/app/app.module.ts,
@ -2183,9 +2183,10 @@ h3#preloading <i>Pre-Loading</i>: background loading of feature areas
`) `)
:marked :marked
In order to enable pre-loading of all modules, we'll import the `PreloadAllModules` token from the router package. The second argument in the The second argument in the `RouterModule.forRoot` method takes an object for additional configuration options.
`RouterModule.forRoot` method takes an object where we can provide additional configuration options. We'll use the `preloadingStrategy` property We import the `PreloadAllModules` token from the router package and set the configuration option's `preloadingStrategy` property
with the `PreloadAllModules` token. This enables the built-in *Router* pre-loader to eagerly load **all** [unguarded](#preload-canload) feature areas that use `loadChildren`. with this `PreloadAllModules` token.
This tells the built-in *Router* pre-loader to immediately load **all** [unguarded](#preload-canload) feature areas that use `loadChildren`.
+makeExcerpt('app/app-routing.module.6.ts (preload all)', '') +makeExcerpt('app/app-routing.module.6.ts (preload all)', '')