I am quite new to Angular and Observables. I want to chain the call of a service a certain number of times. Is there a simple way to use Observables? (a bit like that but with a generic manner).
this.myService.getNodeById(res.parent_id).subscribe(res => {
this.myService.getNodeById(res.parent_id).subscribe(res => {
this.myService.getNodeById(res.parent_id).subscribe(res => {
// while res.parents_id exists
});
});
});
- angular: 12.0.5
- typescript: 4.2.3
- rxjs: 6.6.0