You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 4, 2017. It is now read-only.
Copy file name to clipboardExpand all lines: public/docs/ts/latest/guide/router.jade
+12-11
Original file line number
Diff line number
Diff line change
@@ -2148,28 +2148,28 @@ h3#preloading <i>Pre-Loading</i>: background loading of feature areas
2148
2148
* No pre-loading at all which is the default. Lazy loaded feature areas are still loaded on demand.
2149
2149
* Pre-loading of all lazy loaded feature areas.
2150
2150
2151
-
The *Router* also supports [custom preloading strategies](#custom-preloading) to give us control of what we want to pre-load.
2151
+
The *Router* also supports [custom preloading strategies](#custom-preloading) for fine control over which modules to pre-load.
2152
2152
2153
-
We'll update our *CrisisCenterModule* to be loaded lazily by default and use the `PreloadAllModules` strategy to eagerly
2154
-
it up.
2153
+
We'll update our *CrisisCenterModule* to be loaded lazily by default and use the `PreloadAllModules` strategy
2154
+
to load _all_ lazy loaded modules as soon as possible.
2155
2155
2156
2156
<aid="preload-canload"></a>
2157
2157
.l-sub-section
2158
2158
:marked
2159
-
The **PreloadAllModules** strategy does not eagerly load feature areas protected by the [Can Load](#can-load-guard) and this is by design.
2160
-
The *CanLoad* guard protects against loading feature area assets until authorized to do so. If you want to eagerly load all modules and guard
2161
-
them against unauthorized access, use the [CanActivate](#can-activate-guard) guard instead.
2159
+
The **PreloadAllModules** strategy does not load feature areas protected by a [CanLoad](#can-load-guard) guard and this is by design.
2160
+
The *CanLoad* guard blocks loading of feature module assets until authorized to do so. If you want to both preload a module and guard
2161
+
against unauthorized access, use the [CanActivate](#can-activate-guard) guard instead.
2162
2162
2163
2163
:marked
2164
-
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.
2164
+
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.
2165
2165
In the *crisis-center-routing.module.ts*, we'll change the *crisis-center* path to an *empty path* route.
2166
2166
2167
2167
We'll move our redirect and *crisis-center* route to our `AppRoutingModule` routes and use the `loadChildren` string to load the *CrisisCenterModule*.
2168
2168
The redirect is also changed to load the `/heroes` route on initial load.
2169
2169
2170
2170
Once we're finished, we'll remove the `CrisisCenterModule` from our `AppModule`'s imports.
2171
2171
2172
-
Here are our updated modules:
2172
+
Here are the updated modules _before enabling preload_:
2173
2173
2174
2174
+makeTabs(
2175
2175
`router/ts/app/app.module.ts,
@@ -2183,9 +2183,10 @@ h3#preloading <i>Pre-Loading</i>: background loading of feature areas
2183
2183
`)
2184
2184
2185
2185
:marked
2186
-
In order to enable pre-loading of all modules, we'll import the `PreloadAllModules` token from the router package. The second argument in the
2187
-
`RouterModule.forRoot` method takes an object where we can provide additional configuration options. We'll use the `preloadingStrategy` property
2188
-
with the `PreloadAllModules` token. This enables the built-in *Router* pre-loader to eagerly load **all** [unguarded](#preload-canload) feature areas that use `loadChildren`.
2186
+
The second argument in the `RouterModule.forRoot` method takes an object for additional configuration options.
2187
+
We import the `PreloadAllModules` token from the router package and set the configuration option's `preloadingStrategy` property
2188
+
with this `PreloadAllModules` token.
2189
+
This tells the built-in *Router* pre-loader to immediately load **all** [unguarded](#preload-canload) feature areas that use `loadChildren`.
0 commit comments