How to use ReplaySubject such that its observers can fire repeatedly when it subscribes to a new observable?
0
I am trying to figure how to use ReplaySubject such that its observers can fire repeatedly when it subscribes to a new observable (e.g. HTTP GET). This is provider that I used: export class CatalogService { public borrow$: ReplaySubject<Borrow> = new ReplaySubject<Borrow>(null); constructor(public http: HttpClient) { } public getBorrowView() { this.http.get<Borrow>(apiUrl + 'Borrow/View').subscribe(this.borrow$); } ... } I have two observers - one in the main component and the other in the uninstantiated child component. The observer in the main component subscribe in the following manner: this.catalogService.borrow$.subscribe( borrowList => { if (borrowList != null) this.pages[1].badge = borrowList.length...