Skip to content

Instantly share code, notes, and snippets.

@Mulperi
Created December 11, 2018 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mulperi/22c71d7127d542ef95b16d337a15b5bd to your computer and use it in GitHub Desktop.
Save Mulperi/22c71d7127d542ef95b16d337a15b5bd to your computer and use it in GitHub Desktop.
Dynamic component service
export class DynamicComponentService {
latestComponent = new BehaviorSubject<any>(null);
getLatestComponentStream(): Observable<any> {
return this.latestComponent.asObservable();
}
pushComponent(component: any): void {
this.latestComponent.next(component);
}
removeLatestComponent(): void {
this.latestComponent.next(null);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment