2022-08-28 13:43:57 +02:00
|
|
|
import { PreloadingStrategy, Route } from '@angular/router';
|
|
|
|
import { Observable, timer, mergeMap, of } from 'rxjs';
|
|
|
|
|
|
|
|
export class AppPreloadingStrategy implements PreloadingStrategy {
|
|
|
|
preload(route: Route, load: Function): Observable<any> {
|
|
|
|
return route.data && route.data.preload
|
2022-08-28 20:52:48 +02:00
|
|
|
? timer(1500).pipe(mergeMap(() => load()))
|
2022-08-28 13:43:57 +02:00
|
|
|
: of(null);
|
|
|
|
}
|
|
|
|
}
|