【发布时间】:2017-06-28 17:37:33
【问题描述】:
我有一项服务会每 2 分钟调用一次我的休息服务。在我的服务中,我有以下功能
getNotifications(token: string) {
const body = 'xxxxxxxxx=' + token;
return this.http.post('/rest/ssss/ddddddd/notificationcount', body, this.options)
.map((res) => res.json());
}
在我的组件上,我调用我的服务函数来调用 API。
this.notificationService.getNotifications(this.token).subscribe((data) => {
console.log(data);
});
我想每 2 分钟打一次电话,最好的方法是什么?
【问题讨论】:
-
你看
repeatWhen了吗?
标签: angular rxjs angular-http