How to a call function after dismiss the Modal in Ionic 4

0
1386

As per official document :

const modal = await modalController.create({...});
const { data } = await modal.onDidDismiss();
console.log(data);

See official docs link

As other answers stated, now onDidDismiss() also returns a promise. So you can follow how documentation advises you to capture data or do something like this, its just another syntax basically:

async openModal() {
    const modal = await this.modal.create({ component: UploadPage });
    modal.onDidDismiss().then((data) => {
        console.log(data)
    });
    return await modal.present();
}

actual data will be inside data.data in this case.

LEAVE A REPLY

Please enter your comment!
Please enter your name here