I have a service that will call my leisure service every 2 minutes. In my service, I have the following function
getNotifications(token: string) {
const body = 'xxxxxxxxx=' + token;
return this.http.post('/rest/ssss/ddddddd/notificationcount', body, this.options)
.map((res) => res.json());
}
In my component, I call my utility function to call the API.
this.notificationService.getNotifications(this.token).subscribe((data) => {
console.log(data);
});
I want to make this call every 2 minutes, what is the best way to do this?
Ennio source
share