Being new to Angular and Observables, I am looking for a way to efficiently chain the call of a service multiple times. Is there a straightforward method using Observables that can achieve this in a more generic manner than traditional methods? (similar to this example).
this.myService.getNodeById(res.parent_id).subscribe(res => {
this.myService.getNodeById(res.parent_id).subscribe(res => {
this.myService.getNodeById(res.parent_id).subscribe(res => {
// logic here as long as res.parents_id is present
});
});
});
- angular: 12.0.5
- typescript: 4.2.3
- rxjs: 6.6.0