lwin
lwin

Reputation: 4460

forkJoin is deprecated for multiple observable function

First I have multiple services files like that =>

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'}})           
   }

I tried like=>

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

but why forkJoin is strikethrough and show forkJoin is deprecated?

message=>

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

Upvotes: 1

Views: 3215

Answers (1)

bjdose
bjdose

Reputation: 1309

You must use an array as argument:

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

Upvotes: 4

Related Questions