// myPage.ts
// Passing data to the modal:
let modal = Modal.create(myModal, { data: [...] });
// Getting data from the modal:
modal.onDismiss(data => {
console.log('MODAL DATA', data);
});
// myModal.ts
constructor(inputData: NavParams, private view: ViewController) {
// Getting data from the page:
var dataFromPage = inputData.get('data');
}
dismiss() {
// Returning data from the modal:
this.view.dismiss(
// Whatever should be returned, e.g.:
// { ... }
);
}
Hi. I implemented the code seen from this post Ionic Modal don't return data. How to return data from ionic modals?, which work perfectly.
I have now the exact problem. I want to send the data from the modal to the viewControllew without calling the dimiss() method. the problem is specifically when I click the back button in android devices, where I want my data to be sent even if i press the back button. How to achieve this?