I have a service that will make a call to my rest service every 2 minutes. On 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());
}
On my component I call my service 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?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…