Skip to content

Instantly share code, notes, and snippets.

@CharlieGreenman
Created August 29, 2019 18:12
Show Gist options
  • Save CharlieGreenman/f8e577b812c7616dca643e1aae2a07c3 to your computer and use it in GitHub Desktop.
Save CharlieGreenman/f8e577b812c7616dca643e1aae2a07c3 to your computer and use it in GitHub Desktop.
OnDemandPreloadService that will be using within our CustomPreloadService
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