我有一个使用setInterval
声明中的setInterval函数不更新
public getMoreMessages(route: string) {
this.http.get(this.url + route + "?page=" + MessageService.plus)
.subscribe(function(response) {
if (response.json.length === 0) {
MessageService.plus++;
this.extractAndUpdateMessageList(response);
return;
};
});
}
这里的问题是,在function
定义的一切都必须static
,否则这将是undefined
此方法。这就是为什么我宣称plus
为static
,但我无法声明extractAndUpdateMessageList(响应:响应)也是static
。
有人可以帮我弄清楚如何正确写入它,而不必声明我的变量为static
?
谢谢
它在哪里使用'setInterval'? –