import { PreloadingStrategy , Route } from '@angular/router' ; import { Observable , of } from 'rxjs' ; import { catchError } from 'rxjs/operators' ; import type { NzSafeAny } from 'ng-zorro-antd/core/types' ; example export class PreloadOptionalModules implements PreloadingStrategy { preload ( route , fn ) { return route . data ?. preload === true ? fn ( ) . pipe ( catchError ( ( ) => of ( null ) ) ) : of ( null ) ; } }