Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Unable to close Actionsheet that presents an Alert after clicked

$
0
0

@adrianteh wrote:

Hi,

One of my actionsheet handler creates an alert, but the actionsheet doesn't close after the alert shows up. It's a simple alert with an "OK" button. The use case is, I'm using the action sheet to post to an API endpoint when its clicked. When the API endpoint returns, I show an Alert with a "Thank you message".

Preferably I'd like the ActionSheet to close even before the Alert message is shown.

Any idea how I can close the ActionSheet?

Here's my implementation:

let actionSheet = ActionSheet.create({
      buttons: [
        {
          text: 'Report Abuse',
          role: 'destructive',
          handler: () => {
            let params = { resource_type: this.resourceType, resource_id: this.resourceId }
            this.authHttp.post(this.REPORT_URL, JSON.stringify(params)).toPromise()
              .then(res => {
                AlertService.alert({ nav: this.nav, message: "Thank you for your report. The administrators have been notified.", title: 'Thank You' })
              });
          }
        }, {
          text: 'Cancel',
          role: 'cancel',
          handler: () => {
            return true;
          }
        }
      ]
    });
    this.nav.present(actionSheet);

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>