I’m finding success with
nav.pop() in my modals that are nested within my app. I want to note that I don’t use the
nav elements for actual routing and navigation. Only for sub-menus within sub-menus like modals. Objects that I don’t want to assign an actual route to.
However, with a modal I can wait for the promise from
onWillDismiss for example so that I can handle all of the back events, whether they are generated from buttons or gestures.
With routed components I can subscribe to the angular Router.
However, with Navs, I haven’t found a clean way to await/subscribe to a
nav.pop() event? Closest thing I have been able to do is add an
ngOnDestroy() to the pushed component. But that has a noticeable delay as it only fires after the component is completely offloaded.
I can add a service with an event emitter to handle buttons that go back or dismiss the nav. But it doesn’t account for the swipe to go back gesture then.
Any clean solutions?