angular - catch dismiss event in modal controller from main component -


in mainpage, call function create in modalcontroller, modalpage shown , when click on cancel, calls dismiss function , return mainpage. works fine.

@component({   selector: 'main-page',   templateurl: 'main-page.html' }) export class mainpage{    itemtapped($event, item) {        let detmodal = this.modalctrl.create(modalpage, {item : item});        detmodal.present();    } }   @component({   selector: 'modal-page',   templateurl: 'modal-page.html' }) export class modalpage{    dismiss() {      this.viewctrl.dismiss();    } } 

now, want call function in mainpage after modalpage has been dismissed. there method ?

you can use ondiddismiss (docs) this:

export class mainpage{    itemtapped($event, item) {        let detmodal = this.modalctrl.create(modalpage, {item : item});         detmodal.ondiddismiss(() => {          // executed after modal dismissed...          console.log('hi...');        });         detmodal.present();    } } 

Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -