Dialog before page closes


I want the users to show a dialog when they close a page with the back button. How can I prevent the page to go back when the dialog is shown?

app.dialog.confirm('Are you sure?', function () {

Add prevent-router class to that this link to prevent automatic routing on click