In below code,
$window.onbeforeunload = function reloadFunc(event) {
// Check if form is dirty, prompt the user and cancel event
scope.dirtyCheckWarning(event);
};
I am figuring out how to cancel the event and stop propogation.