【发布时间】:2018-07-19 08:55:20
【问题描述】:
我在组件中有这个方法:
saveItem() {
return this.itemService.updateItem(this.item)
.pipe(
tap((data: any) => {
this.toastr.success('Saved');
}),
catchError((error: any) => {
return throwError(error.error);
}
)
)
}
这是 itemService 中的函数:
updateItem(item: Item) {
return this.http.post<any>(this.updateItemUrl, {
item: item
});
}
如果我在'return this.itemService.updateItem(this.item)' 行的 saveItem() 中放置一个断点,并且如果我在'return this.http 行的 updateItem() 中放置一个断点。 ..',它正确地进入断点并停止...... 但是我有以下问题:没有触发rest-api调用,也没有发送http调用..事实上,如果我在.pipe()运算符中放置了一个断点,它不进去。为什么?
【问题讨论】:
-
您是否在任何地方订阅?要么在组件类中,要么在带有
| async的模板中?
标签: angular rxjs ngrx angular-httpclient