Created
August 29, 2019 18:12
-
-
Save CharlieGreenman/f8e577b812c7616dca643e1aae2a07c3 to your computer and use it in GitHub Desktop.
OnDemandPreloadService that will be using within our CustomPreloadService
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { Subject } from 'rxjs'; | |
export class OnDemandPreloadOptions { | |
constructor(public routePath: string, public preload = true) {} | |
} | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class OnDemandPreloadService { | |
private subject = new Subject<OnDemandPreloadOptions>(); | |
state = this.subject.asObservable(); | |
startPreload(routePath: string) { | |
const message = new OnDemandPreloadOptions(routePath, true); | |
this.subject.next(message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment