SpyNgModuleFactoryLoader
class
Allows to simulate the loading of ng modules in tests.
class SpyNgModuleFactoryLoader implements NgModuleFactoryLoader {
  stubbedModules: {...}
  load(path: string): Promise<NgModuleFactory<any>>
}   Description
const loader = TestBed.inject(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');   Properties
| Property | Description | 
|---|---|
  stubbedModules: {
    [path: string]: any;
}  |  
Methods
|     load()      | |||
|---|---|---|---|
   |  
  path  |  string |  
Returns
Promise<NgModuleFactory<any>>
    © 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
    https://v9.angular.io/api/router/testing/SpyNgModuleFactoryLoader