【发布时间】:2020-12-04 20:35:56
【问题描述】:
我想重构它以使用可观察对象:
post<T>(
url: string,
body: any,
params?: HttpParams,
headers?: HttpHeaders
): Observable<T> {
this.isLoading$.next(true);
const res = this.http
.post<T>(url, body, { headers, params })
.pipe(timeout(3000));
this.isLoading$.next(false);
return res;
}
如何在帖子返回后立即发出 isLoading$ observable,但不更改函数返回类型?
【问题讨论】:
标签: angular rxjs observable rxjs-observables