I have a results page. When navigating to this page, a search modal is created directly.
In the search page user can introduce a query and submit his search, or cancel.
In case there is a query, the results page is showing the results.
On the other hand, if user cancel the search, I want to pop the result page:
openSearchModal() {
let searchModal = this.modalCtrl.create(SearchPage, {
:
:
});
SearchModal.onDidDismiss(data => {
this.handleModalData(data);
});
searchModal.present();
}
handleModalData(data) {
let q = data['q'];
if (!q) {
this.navCtrl.pop();
} else {
// handle search query......
:
:
}
}
My problem is that when canceling the search, user gets to see for a second the results page before app sends him back.
I tried to use popTo from modal, but couldn't manage to achieve what I want.