I am blocked with this,
In Angular 2, I need to block any user click event, even browser refresh if the form in the page is dirty
Could you help me with ideas?
I am blocked with this,
In Angular 2, I need to block any user click event, even browser refresh if the form in the page is dirty
Could you help me with ideas?
It seems you are looking for canDeactivate
It allows you to block routing away. You would need a shared service where you update the forms dirty state so that the guard can access it.
The angular docs cover this exact question:
https://angular.io/guide/router#candeactivate-handling-unsaved-changes I'd leave that as a comment but I lack the reputation to do so.