{ "id": "api/router/RouterPreloader", "title": "RouterPreloader", "contents": "\n\n
\n
\n
\n \n API > @angular/router\n
\n \n
\n \n
\n

RouterPreloaderlink

\n \n \n \n \n \n
\n \n \n\n
\n \n
\n

The preloader optimistically loads all router configurations to\nmake navigations into lazily-loaded sections of the application faster.

\n\n

See more...

\n
\n \n \n \n
\n\nclass RouterPreloader implements OnDestroy {\n setUpPreloading(): void\n preload(): Observable<any>\n}\n\n\n \n \n\n
\n\n\n \n\n \n \n
\n

Descriptionlink

\n

The preloader runs in the background. When the router bootstraps, the preloader\nstarts listening to all navigation events. After every such event, the preloader\nwill check if any configurations can be loaded lazily.

\n

If a route is protected by canLoad guards, the preloaded will not load it.

\n\n \n
\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n
\n

Methodslink

\n \n \n\n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n

\n setUpPreloading()\n \n link

\n \n
\n
\n
\n \n\n setUpPreloading(): void\n\n \n\n
Parameters
\n

There are no parameters.

\n\n \n
Returns
\n

void

\n\n \n\n\n \n\n \n
\n
\n\n \n \n\n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n

\n preload()\n \n link

\n \n
\n
\n
\n \n\n preload(): Observable<any>\n\n \n\n
Parameters
\n

There are no parameters.

\n\n \n
Returns
\n

Observable<any>

\n\n \n\n\n \n\n \n
\n
\n\n \n
\n\n\n\n \n\n\n
\n
\n\n\n" }