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