Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

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

Merged
merged 1 commit into from
Oct 31, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions public/docs/ts/latest/guide/router.jade
Original file line number Diff line number Diff line change
Expand Up @@ -2148,28 +2148,28 @@ 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.
* 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
it up.
We'll update our *CrisisCenterModule* to be loaded lazily by default and use the `PreloadAllModules` strategy
to load _all_ lazy loaded modules as soon as possible.

<a id="preload-canload"></a>
.l-sub-section
:marked
The **PreloadAllModules** strategy does not eagerly load feature areas protected by the [Can Load](#can-load-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
them against unauthorized access, use the [CanActivate](#can-activate-guard) guard instead.
The **PreloadAllModules** strategy does not load feature areas protected by a [CanLoad](#can-load-guard) guard and this is by design.
The *CanLoad* guard blocks loading of feature module assets until authorized to do so. If you want to both preload a module and guard
against unauthorized access, use the [CanActivate](#can-activate-guard) guard instead.

: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.

We'll move our redirect and *crisis-center* route to our `AppRoutingModule` routes and use the `loadChildren` string to load the *CrisisCenterModule*.
The redirect is also changed to load the `/heroes` route on initial load.

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(
`router/ts/app/app.module.ts,
Expand All @@ -2183,9 +2183,10 @@ h3#preloading <i>Pre-Loading</i>: background loading of feature areas
`)

: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
`RouterModule.forRoot` method takes an object where we can provide additional configuration options. We'll use the `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`.
The second argument in the `RouterModule.forRoot` method takes an object for additional configuration options.
We import the `PreloadAllModules` token from the router package and set the configuration option's `preloadingStrategy` property
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)', '')

Expand Down