Ошибка при опускании для обновления в Ionic3 - PullRequest
0 голосов
/ 22 января 2019

эй, я пытаюсь обновить свой список продуктов, потянув вниз в ионном.В первый раз работает, но после этого выдает эту ошибку

Error: Uncaught (in promise): removeView was not found
    at c (http://localhost:8101/build/polyfills.js:3:19752)
    at c (http://localhost:8101/build/polyfills.js:3:19461)
    at http://localhost:8101/build/polyfills.js:3:20233
    at t.invokeTask (http://localhost:8101/build/polyfills.js:3:15660)
    at Object.onInvokeTask (http://localhost:8101/build/vendor.js:5125:33)
    at t.invokeTask (http://localhost:8101/build/polyfills.js:3:15581)
    at r.runTask (http://localhost:8101/build/polyfills.js:3:10834)
    at o (http://localhost:8101/build/polyfills.js:3:7894)

Мой код для обновления контента: Для HTML

<ion-refresher (ionRefresh)="doRefresh($event)">
        <ion-refresher-content  pullingIcon="arrow-dropdown"
        pullingText="Pull to refresh"
        refreshingSpinner="circles"
        refreshingText="Refreshing..."></ion-refresher-content>
    </ion-refresher>

В файле TS

doRefresh(refresher) {
    console.log('Begin async operation', refresher);

    let loading = this.loadingCtrl.create({
      spinner: 'hide',
      content: `<img src="./assets/imgs/gif.svg" class="h15" />`,
    });
    this.service.getBrand().then((response:any)=>{
      loading.dismiss();
      this.brandlist = response;
    });
    this.serv.getProductList(this.sub_categoryes,this.filterCopy,this.newarrival,this.brand).then((response:any)=>{
      loading.dismiss();
      console.log(response);

      this.productlist = response;
      this.tmp_arr=response;
    });
    loading.present();
  }

1 Ответ

0 голосов
/ 22 января 2019

Когда вы звоните dismiss вручную, вам нужно подождать, пока loading.present() не будет решен

 this.loading.present().then(() => {
    this.service.getBrand().then((response: any) => {
        loading.dismiss();
        this.brandlist = response;
    });

    this.serv.getProductList(this.sub_categoryes, this.filterCopy, this.newarrival, this.brand).then((response: any) => {
        loading.dismiss();
        console.log(response);

        this.productlist = response;
        this.tmp_arr = response;
    });

});

Проверить это .

...