In my angular app, I need to warn the user before he leaves a specific page, not every page.
If I use $locationChangeStart in the page controller, where I want to warn the user, it will work even when it comes to the page, which is undesirable.
If I use it on the parent controller, it will run everywhere, and I need to add a complex if / else or switch structure to basically say that it never starts unless the user leaves this particular state.
How to determine that the user is actually leaving (and only leaving) from a particular state using a UI router?
Tiago source share