对于多个可观察函数,不推荐使用 forkJoin

forkJoin is deprecated for multiple observable function

首先我有多个这样的服务文件=>

services1.ts

Patch(updateobject:object,id:number): Observable<MyObject> {    
    return this.http.patch<MyObject>(`${this.MyObject_API}/${id}`,  JSON.stringify(updateobject),{headers:{'Content-Type': 'application/json'}})           
   }

services2.ts

Patch(updateobject:object2,id:number): Observable<MyObject> {    
    return this.http.patch<MyObject>(`${this.MyObject2_API}/${id}`,  JSON.stringify(updateobject),{headers:{'Content-Type': 'application/json'}})           
   }

我试过了=>

forkJoin(service1.patch(),service2.patch()).subscribe(([call1response,call2response])....

但为什么 forkJoin 是删除线而显示 forkJoin 已弃用?

留言=>

(v1: ObservableInput<MyObject>, v2: ObservableInput<MyObject>): Observable<[MyObject, MyObject]>' is deprecated

您必须使用数组作为参数:

forkJoin([service1.patch(),service2.patch()]).subscribe(([call1response,call2response])....