Is it possible to veto against transition away from a view?

In desktop toolkits it is common to have a callback when a user request to close a window. This callback often have the ability to veto against closing the window.

In Ionic, is there any equivalent? In mobile apps we don’t want save buttons, but what if saving fails when transitioning away from a edit item view? I would like to veto against both UI back button and android hardware button and display a confirm dialog [“try again?”, “abort”] which then codewise can do goBack() if user is okay with the edits not being saved.

Can $ionicView.beforeLeave do this veto?. The docs kind of imply it is not possible, but on the other hand it doesn’t list any arguments to this method or any of the other transition events.