I am implementing authentication checking using $routeChangeStart as explained here and looking for a way to preserve all detail provided in the next
object. AngularJS documentation on $route shows that you can set the $route.current
and I was hoping that I do something like the following to change the $route
instead of using $location
:
$route.current = { templateUrl: 'detail.html', controller: 'MainCtrl' };
$route.reload();
I know that $route.current can be updated because console.log
after setting it shows that it does pickup the change:
console.log("current route: ", $route.current.templateUrl );
Unfortunately it does not work. The application I am creating have additional parameters defined using $routeProvider
that I would like to preserve.
Any ideas?
Here is a Plunker I setup to illustrate this.