I wrote an Angular2 (v2.0.1) application that makes use of the router. The website is loaded with several query string parameters, so the full URL initially looks like this:
Günter Zöchbauer's answer should work properly but, for some reason, it is not working for me at all. What did end up working was passing the queryParams
directly instead of 'preserving' them.
This is what my guard looks like:
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
(...)
this.router.navigate(['login'], { queryParams: route.queryParams });
}