I have this service using HttpClient to get some data :
checkData() {
return this.http.get(\'my url\');
}
The on the footer component I
I am referring to angular 8:
Please note the difference between timer and interval.
You would use the timer if you want to delay a single function call but you want to use an invertal if you want to fire multiple function calls in sequence with a delay between: http://tutorials.jenkov.com/angularjs/timeout-interval.html
I found the following code snipped in this blog post: http://tutorials.jenkov.com/angularjs/timeout-interval.html
ngOnInit() {
interval(5000)
.pipe(
startWith(0),
switchMap(() => this.apiService.getTweets())
)
.subscribe(res => this.statuses = res.statuses})
;
}