Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
cancelling routes #2109
There is currently no good/documented way of canceling a route change.
I'm playing around with simulating a back button in the
$location.url() // 'somePath' $window.history.go(-1); $location.url() // 'somePath' still $window.history.back(); $location.url() // 'somePath' still
Maybe that's part of the problem.
This was referenced
Mar 22, 2013
referenced this issue
Apr 13, 2013
added a commit
May 1, 2013
The event $locationChangeStart has as it's second parameter the 'next' route but all it shows is the full path: "http://localhost:3000/#/users" Surely if you expect people to use this to cancel routes it should include only the /users (for example) part of the path as $routeChangeStart event does with it's 'originalPath' property.
Right now we're forced to parse the URL to use this.
These inconsistencies need to be cleaned up, they make it a nightmare to learn angular.
@nickspacek I had the same problem. I resolved it by injecting
As @WhatFreshHellIsThis mentioned there are inconsistencies with the arguments for
In my case, on
The downside to my
We do this. I added a provider which the resolve property of the router utilizes. It tests a variety of auth conditions and either redirects the user to their destination or back to the login screen. We apply this provider to all routes and use API header authentication, combined with Rails sessions to allow a session to persist over multiple visits. At least... I think that's what we have, I'm definitely a UI guy.