I have this service using HttpClient to get some data :
checkData() {
return this.http.get(\'my url\');
}
The on the footer component I
Hope this will help you
export class YourComponent implements OnInit, OnDestroy {
private alive: boolean;
constructor(){}
ngOnInit(){
this.alive = true;
TimerObservable.create(0, 10000)
.pipe(
takeWhile(() => this.alive)
)
.subscribe(() => {
this.myservice.checkdata().subscribe( result => { this.statustext = result } );
});
}
ngOnDestroy(){
this.alive = false;
}
}