Last active
January 5, 2024 06:47
-
-
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
helped me a lot as well!! thanks!