On this page
SpyNgModuleFactoryLoader
class
| npm Package | @angular/router | 
|---|---|
| Module | import { SpyNgModuleFactoryLoader } from '@angular/router/testing'; | 
     
| Source | router/testing/src/router_testing_module.ts | 
Overview
class SpyNgModuleFactoryLoader implements NgModuleFactoryLoader {
  constructor(compiler: Compiler)
  stubbedModules: {[path: string]: any}
  load(path: string): Promise<NgModuleFactory<any>>
}
  How To Use
const loader = TestBed.get(NgModuleFactoryLoader);
@Component({template: 'lazy-loaded'})
class LazyLoadedComponent {}
@NgModule({
  declarations: [LazyLoadedComponent],
  imports: [RouterModule.forChild([{path: 'loaded', component: LazyLoadedComponent}])]
})
class LoadedModule {}
// sets up stubbedModules
loader.stubbedModules = {lazyModule: LoadedModule};
router.resetConfig([
  {path: 'lazy', loadChildren: 'lazyModule'},
]);
router.navigateByUrl('/lazy/loaded');
  Constructor
constructor(compiler: Compiler)
  Members
stubbedModules: {[path: string]: any}
  load(path: string): Promise<NgModuleFactory<any>>
  Annotations
@Injectable()
  © 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
 https://v4.angular.io/api/router/testing/SpyNgModuleFactoryLoader