My methods have dependencies where one method needs to complete before the next can be called.
process1(data: string) : Observable<string> {
this.dataservice.process(data).subscribe(
(response) => {
return response.data;
}
);
}
main(data: string) : string {
var process1Data: string = process1(data);
// I need to wait for process1 method to finish before executing process2
// I don't want to nest process2 inside subscribe of process1 due to additional method calls
var process2Data: string = process2(process1Data);
var process3Data: string = process3(process2Data);
...
}
Is there a way to delay calling the next method until an observable is fully completed (similar to await in C#)?