In my angular app, I need to warn the user before he leaves a specific page, not every page.
If I use a $locationChangeStart
within the controller of the page where I want to warn the user, it will trigger even when coming to the page, which is not desired.
If I use it on the parent controller, it will trigger everywhere and I have to add a complex if/else or switch structure to basically tell it to never trigger unless a user is abandoning that specific state.
How do I detect that a user is actually leaving (and only leaving) a specific state
using UI-Router?