RouterPreloader

Stable Class

Class Overview

class RouterPreloader {
  constructor(router: Router, moduleLoader: NgModuleFactoryLoader, compiler: Compiler, injector: Injector, preloadingStrategy: PreloadingStrategy)
  
  
  setUpPreloading() : void
  preload() : Observable<any>
  ngOnDestroy()
}

Class Description

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

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.

Annotations

@Injectable()

Constructor

constructor(router: Router, moduleLoader: NgModuleFactoryLoader, compiler: Compiler, injector: Injector, preloadingStrategy: PreloadingStrategy)

Class Details

setUpPreloading() : void
preload() : Observable<any>
ngOnDestroy()

exported from @angular/router/index, defined in @angular/router/src/router_preloader.ts

© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v2.angular.io/docs/ts/latest/api/router/index/RouterPreloader-class.html