2
我正在嘗試以獲取滾動文本上的數據,並填充一個「Article []」的數組。
httpLoadArticles() {
this.httpWSGetInit().subscribe(
articles => this.articles = articles,
err => {
console.log(err);
},
() => console.log('Searching complete')
}
而且目前的功能。
httpWSGetInit() : Observable<Article []> {
return this.http.get(R.WEBSITE_URL_WS + this.articlesPagination)
.map((res:Response) => res.json())
.catch((error:any) => Observable.throw(error.json().error || 'Server error'));
}
工作得很好。
但是http.get
方法從未在addScrollListener
中調用。
@ViewChild(Content) content: Content;
ionViewDidLoad() {
this.content.addScrollListener(this.onPageScroll);
}
onPageScroll(event) {
this.httpLoadArticles()
}
我試圖設置GET
爲synchronous
,但它似乎沒有任何改變。這是一個scope
的問題?像addScrollListener
是純JS方法,不能附加到angular2
容器?
謝謝你,它的作品像一個魅力:)。你有任何文件嗎? – Dinath