I have two buttons
<button (click)="httpOne()">Btn 1</button>
<button (click)="httpTwo()">Btn 2</button>
clicking on the buttons i am triggering a http request.
When i click on Btn 1 the http requests needs 10 seconds to be resolved.
When i click on Btn 2 the http requests needs 4 seconds to be resolved.
httpOne() {
this.http.get('some-url-1').subscribe(response => {
});
}
httpTwo() {
this.http.get('some-url-2').subscribe(response => {
});
}
So i first click on button 1, then i click on button 2.
I need to wait for the http call from Btn 1 when i click on button 2.
And when the http call is done on Button 1, then i need to start the call on Btn 2.
I know that i can disable the button, but people the client does not want that.I need solution for this because i am struggling with this.
httpTwo()to complete before invokinghttpOne()?