You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

13 lines
434 B

import { Injectable } from '@angular/core';
import { PreloadingStrategy, Route } from '@angular/router';
import { Observable, of } from 'rxjs';
@Injectable()
export class ModulePreloadService implements PreloadingStrategy {
/**
* Preloads all lazy loading modules with the attribute 'preload' set to true
*/
preload(route: Route, load: Function): Observable<any> {
return route.data?.preload ? load() : of(null);
}
}