Display a customized confirm box in angularjs when user leaves a page

My requirement is to display a customized confirm box when the user leaves a page without saving form data.

I used the window.onbeforeunload event it is displaying google chrome related predefined confirm box. When the user changes any form and trying to reload, tab close or route change I want to display a $mdDialog.confirm and asking user to leave the page or stay on the same page. How do I make one?

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/10/14/display-a-customized-confirm-box-in-angularjs-when-user-leaves-a-page/
via @lzomedia #developer #freelance #web #lzomedia.com

Comments

Popular posts from this blog

ng-show doesn’t work correct with value boolean

Using PHP and MySQL data to generate PDF letters like in MS Word mailmerge functionality - development

ng-include of inline SVG does not display gradient except in Chrome