I have a route
which has to resolve
a server side resource. That resource asks for authentication. So i show a login form popup which is cancelable. On cancel the route/resolve gets rejected
and $routeChangeError
fires correctly.
The issue is, that i now have that failed location/url in address bar and a needless history entry.
How do you replace the current location url to the last one without reload? And how do you remove the current history entry after route change failed?
Edit: I use angular-http-auth. Here is my routing:
/home
> /item
(has to resolve a resource that requires authentication, when not logged in a login form popup opens up which is cancelable)
When i cancel the authentication a $routeChangeError gets fired and i'm still on /home
page due to /item
never rendered. Now the address bar shows a wrong url: /item
You just need to send them back one step in your history. Don't worry about the history record being there, it will be overwritten when they navigate to the next thing:
And here's a demo Plunk