Unsaved Changes: Conditionally Cancel Swipe to Go Back


Hey there - looking for some functionality that I’ve been unable to find here or elsewhere. In a project I have a view in which users can edit information (pretty basic) and I would like to create an alert of sorts prompting users to save their work before navigating back.

In order to do so I’m trying to find an event I can hook into when a user either a) presses the “Back” navigation button or b) swipes to go back so that I can conditionally prompt them if there are unsaved changes. If there are unsaved changes I would then prompt them with the option to either go back anyway, or alternatively cancel the go back action and remain on the current page.

Any events that I am missing which would support this type of functionality?



Is it possible to implement something like the Hardware-Back-Button from Android (http://ionicframework.com/docs/api/service/$ionicPlatform)
Not only an event also the bound action (any method triggered) to the swipe-to-go-back functionality?