I don't know if it's the better solution but I need a function that subscribes to two ngrx selectors and use it as parameters for two http services and I used combineLatest:
combineLatest([this.selectedCompany$, this.account$]).subscribe(res => {
this.idCompany = res[0]!.id;
this.account = res[1];
this.getDashboardCardService(this.account!.id.toString(), this.idCompany.toString(), 'time');
this.getavailableSpaceService(this.idCompany).subscribe(res => {
this.space = res;
})
}).unsubscribe();
I use combineLatest to subscribe to two ngrx selectors and in subscribe I need to use these values for doing two http calls, getDashboardCard and available. It works but I don't like it...which is the better solution for doing it?
question from:
https://stackoverflow.com/questions/66052738/rxjs-how-to-call-two-httpservice-after-combinelatest 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…