如何优化这片离子代码

时间:2018-01-18 19:47:50

标签: javascript ios angularjs ionic-framework

我已经加载了这段加速缓慢的离子代码:

ionViewWillEnter(){
this.morePagesAvailable = true;
let loading = this.loadingCtrl.create();

loading.present();

this.post = this.navParams.get('item');

Observable.forkJoin(
  this.getAuthorData(),
  this.getCategories())
  .subscribe(data => {
    this.user = data[0].name;
    this.categories = data[1];
    loading.dismiss();
  });
}

  getAuthorData(){
    return this.wordpressService.getAuthor(this.post.author);
  }

  getCategories(){
    return this.wordpressService.getPostCategories(this.post);
  }

wordpressService是来自REST API的getter。有人可以帮帮我吗?

谢谢, 罗热

0 个答案:

没有答案
相关问题