Reputation: 12819
I have a controller Login that save the previous route like that :
$scope.$on('$routeChangeSuccess', function (event, currentRoute, previousRoute) {
security.previousRoute = previousRoute;
});
So I save the previousRoute in my factory security...
Inside that factory I need change my location using that ! How can I do that? I tried that :
security.previousRoute.reload();
but that Route object does not have the reload method...
Thanks
My previousRoute object:
| y {params: Object, pathParams: Object, $$route: Object, loadedTemplateUrl: "/app/template/user/index.html", reloadOnSearch: true…}
- $$route: Object
- loadedTemplateUrl: "/app/template/user.html"
- params: Object
- pathParams: Object
- __proto__: Object
Upvotes: 1
Views: 3324
Reputation: 19037
Just use $location property to set the url
$location.path(security.previousRoute);
Upvotes: 2