Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

RouterPreloader

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

See more...

      
      class RouterPreloader implements OnDestroy {
setUpPreloading(): void
preload(): Observable<any> }

Provided in

  • 'root'

Description

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

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

Methods

      
      setUpPreloading(): void
    
Parameters

There are no parameters.

Returns

void

      
      preload(): Observable<any>
    
Parameters

There are no parameters.

Returns

Observable<any>