【发布时间】:2023-03-16 21:20:02
【问题描述】:
当内部 observable 完成执行时,控件进入错误块。
我的组件服务层 - 控制转到错误块。
this.ApplicationService.getPageData(id).subscribe((DataObj)=>{
console.log(DataObj);
},
(error)=>{
console.log('Failed to get data.'); <-- The control comes here
})
在我的应用服务层 -
return this.dbService.queryData(req).pipe(mergeMap((r)=>{
if(r!=null) {
let key : string = r.other_id;
return dbService.queryOtherSource(key).pipe(map((r1)=> {
if(r1) {
obj = do some data processing
return of(obj); <-- Control comes here.
}
},
(err)=> {
throw err;
}));
}
},
(error)=>{
throw error;
}));
【问题讨论】:
标签: angular typescript rxjs observable