Close ionicModal when click to notification

Hi, could somebody help me on this?
In my app, clicking to a notification will navigate to other view, like this:

cordova.plugins.notification.local.on("click", function(notification) { $state.go("detailPage", {pageId:}) }

It s working perfectly. But if I’m opening a modal in the current view (using $ionicModal), then click a notification, the modal will not hide. If I close the modal, I will see the navigated view.

Do anybody meet the same problem ?
Thank you for your time.

i think the modal is independend from the navigating (only if you are using history back or hardware back button).

Just add a listener for the $stateChangeStart event in the modals controller --> and hide all modals if you try to navigate to another state.

1 Like

You are my life saver. It works. I did tried $ionicView.leave, it was not working but now I think I get it.
Thank you and cheers!