If user tries to leave unsaved edited form, a message box pop-up
\"This page is asking you to confirm that you want to leave - data you have entered may not be saved. Le
If you want to cancel the route change when you determine your form is dirty, you can do this:
$rootScope.$on('$locationChangeStart', function(event) { event.preventDefault(); });
This will cancel the routing and keep you on the current page.