简体   繁体   中英

ionic 3 loadingcontroller enable backdrop dismiss not working

I have successfully created a loader using following code

presentLoading() {
    this.loadingCtrl.create({
      content: 'Please wait...',
      //duration: 3000,
      dismissOnPageChange: true,
      showBackdrop: true,
    }).present();
  }

but i am not able to place enableBackdropDismiss any where in code i don't know where to put it and how to use it to dismiss my loader

You can use it like other propertive. When it is setted to true , user can dismiss your loading by tapping the backdrop. If you want to dismiss your loading in your code, you need create a varible to represent it:

presentLoading() {
    let loading = this.loadingCtrl.create({
      content: 'Please wait...',
      //duration: 3000,
      dismissOnPageChange: true,
      showBackdrop: true,
      enableBackdropDismiss: true
    }).present();
    //Compute, ajax call or what ever you want
    //Dismiss loading
    loading.dismiss();
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM