【发布时间】:2023-04-07 10:17:01
【问题描述】:
在我需要根据 userid 拨打电话后,我正在尝试获取 Userid 和 serviceId,这里的 serviceId 问题是它没有将 observable 返回到 ts。
服务.ts
function getData():observable<any>{
combineLatest([
this.activeSellService.getActiveSellServiceId(),
this.authService.getUserId(),
]).subscribe(([serviceId, userId]) => {
if (serviceId&& userId) {
const Url =
'users/' +
`${userId}` +
'/services/' +
`${serviceId}` +
'?value=test
return this.http.get<any>(this.endPoint.getUrl(encodeURI(Url)));
}
})
}
组件.ts:
this.service.getData().subscribe(data=>{console.log(data));
即使它没有在控制台中打印数据,因为服务没有返回可观察的。请帮我解决这个问题。否则我们可以在 rxjs 中使用不同的解决方案吗?
【问题讨论】:
标签: angular rxjs angular9 fork-join combinelatest