Skip to content

Instantly share code, notes, and snippets.

@aliyeysides
Last active January 5, 2024 06:47
Show Gist options
  • Save aliyeysides/efca74ec7d428219360cf5ea9fee1cbf to your computer and use it in GitHub Desktop.
Save aliyeysides/efca74ec7d428219360cf5ea9fee1cbf to your computer and use it in GitHub Desktop.
example use of .switchMap that streams value to multiple inner observables using static .combineLatest method
this.symbolSearchService.getSymbolData('xl')
.switchMap(stock => {
this.stock = stock;
return Observable.combineLatest(
this.symbolSearchService.getResearchReportData(stock),
this.symbolSearchService.getPGRDataAndContextSummary(stock)
)})
.subscribe(
[report, summary] => {
this.researchReport = report;
this.contextSummary = summary;
},
err => this.sharedService.handleError
);
@eafiontzi
Copy link

helped me a lot as well!! thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment