我想使用此代码发送请求(我也尝试过forkJoin),并且在调用之间有延迟:
duplicateElement(id: string): Observable<any> {
return this.http.get({ routeName: 'route_name', params: { id } });
}
duplicateElements(ids: string[]): Observable<any> {
return from(ids)
.pipe(
mergeMap(id => this.duplicateElement(id).pipe(delay(1000))
));
}
Run Code Online (Sandbox Code Playgroud)
但.pipe(延迟(1000)无法正常工作:1000毫升后发送每个http请求.