}
ngOnDestroy() {
- if (this.secondsInterval !== null) {
+ if (this.stats !== null && this.stats.secondsInterval !== null) {
clearInterval(this.interval);
}
}
- get remainingSeconds() {
- return Math.floor(this.stats.remainingMilliSeconds / 1000);
- }
-
- get secondsInterval() {
- return Math.floor(this.stats.milliSecondsInterval / 1000);
- }
-
getStats() {
this.requestService.getStats().subscribe(
stats => {
- console.log(stats);
this.stats = stats;
this.runInterval();
},
- err => alert(err)
+ err => alert(err.text)
);
}