I need to Final Count to always be 1, this is storing the fail request count. I am also unsure as why the Final Count is printed before the Initial Count. I am not understanding the subscribe properly maybe. Hopefully this makes sense.
public failed: number = 0;
buttonClickMethod(): void {
// request code
Observable.onErrorResumeNext(myrequests).first().subscribe(
() => {
// On next code
},
() => {
this.failed++;
console.log('Initial count' + this.failed)
},
() => {
//On completed code
}
});
console.log('Final count' + this.failed)
this.failed = 0;
}