Prevent Page navigation - SweetAlert
Prevent Page navigation - SweetAlert I'm trying to replace the JS box dialog with sweet alert dialog box. At normal cases, it works perfectly. But, at the time of navigating the page on confirmation. It didn't work. JS box : var confirm = window.confirm("Warning! You may have unsaved data,it will be lost..!" + "n" + "Are you sure want to leave this page ?"); if (confirm) { $scope.$eval(event); //It prevents the page to nav ,until i confirm it. } else { event.preventDefault(); } It works. In case of sweetalert , I'm using the same scenario sweetalert $scope.validation = function(event) { //.... sweetAlert({ title: "Are you sure?", //Bold text text: "Your will not be able to recover this imaginary file!", //light text type: "warning", //type -- adds appropiriate icon showCancelButton: true, // displays cancel btton confirmButtonColor: "#DD6B55", ...