You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
It's a common use case in an application to prompt the user when a route change is detected with the current page editing a dirty record.
To do this we need to add a listener for $locationChangeStart event. This listener gets called with the event and the new url that would be navigated to.
In this event we preventDefault and then prompt the user if they really want to navigate away from a dirty record. If they say "yes" then we have a problem because the new url parameter passed to our handler is actually the entire path and if we feed it to $location.path(newUrl) it fails because it's the entire url, not just the part that $location.path expects.