I have a component with this code
this.service().subscribe((result) => { this.service2(result).subscribe((result2) => //other code }}
I'm applying good practices in Angular and seems this is not a good approach for this kind of code. But not sure how to improve this.
any suggestion?
Use switchMap
operator:
this.service.getSomething().pipe(
switchMap(result1 => this.service.getSomething2())
)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments