【发布时间】:2021-05-09 04:09:32
【问题描述】:
我不知道这是否是更好的解决方案,但我需要一个订阅两个 ngrx 选择器并将其用作两个 http 服务的参数的函数,我使用了 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();
我使用 combineLatest 订阅两个 ngrx 选择器,在订阅中我需要使用这些值来执行两个 http 调用 getDashboardCard 和 available。它有效,但我不喜欢它......这是更好的解决方案吗?
【问题讨论】:
标签: javascript angular typescript rxjs ngrx