rx.js – chain requests when need response from BOTH

On the end i need response from BOTH requests, but need chain them, because second request need something from first response. import { switchMap, map } from ‘rxjs/operators’;   this.restService.getFile(id) .pipe( switchMap((file:File) => this.restService.renderMd(file.markdown_id) .pipe(map((markdown:any) => { return { file:file, markdow: markdown }; })) ) ).subscribe((result:any) => { // I have results for two requests Read more about rx.js – chain requests when need response from BOTH[…]

rx.js – chain requests

I don’t need result from first request, but need their response for second request (`switchMap` will be working, too) import { mergeMap } from ‘rxjs/operators’;   this.http.get(’/request1’).pipe( mergeMap((resp1:any) => this.http.post(’/request2′, resp1) ) ).subscribe(res => { // I have result from second request only console.log(res); });import { mergeMap } from ‘rxjs/operators’; this.http.get(‘/request1’).pipe( mergeMap((resp1:any) => this.http.post(‘/request2’, resp1) Read more about rx.js – chain requests[…]