import { Injectable } from '@angular/core' ; import { PreloadingStrategy , Route } from '@angular/router' ; import { Observable , of } from 'rxjs' ; @ Injectable ( ) export class PreloadSelectedModuleStrategy implements PreloadingStrategy { preload ( route , load ) { if ( route . data && route . data . preload ) { return load ( ) ; } else { return of ( null ) ; } } }