In some of the previous betas of Ionic 2, if you opened a modal and then pushed new pages from that modal, you could from any of those pages call
nav.popToRoot() and it would reset that navigation stack and close the modal.
However, now in beta 11 (and perhaps earlier betas as well), if I call popToRoot() from one of those pushed pages, the stack is reset back to the modal, but the modal is not closed.
Is there a way to close the modal together with all its “children pages”, preferably with the same animation as when the modal closes?
I hope it’s ok if I bump this.
One last go. I still haven’t found a nice way to do this.
Right now, I’m closing the stack like this:
.then(() => this.nav.first().dismiss());
It works but I would like to avoid the animation happening in two steps. First the pages animate horizontally on pop, and then, the modal animates vertically. Ideally, the entire stack should should animate vertically in just one step, just like it all was a part of the initial modal.
I’m having the same issue. I have a modal that I’m adding pages to, and would like to close the modal on the last page when a user clicks a button.
Your solution was the exact same one that I thought of, and seems to be the only one that works. It seems you can only dismiss the modal view from the modal view controller. Calling dismiss on any pages added will only animate backwards in the stack.
Calling dismiss on the modal view while other pages are in the stack doesn’t work either.