import { Injectable } from '@angular/core' ; import { PreloadingStrategy , Route } from '@angular/router' ; import { Observable , EMPTY } from 'rxjs' ; @ Injectable ( { providedIn : 'root' } ) export class OptInPreloadStrategy implements PreloadingStrategy { preload ( route , load ) { return route . data && route . data [ 'preload' ] ? load ( ) : EMPTY ; } }