I'm creating a redirect in angular 6
The redirect itself is very simple it works like this
get destination url from params:
this.returnUrl = this.route.snapshot.queryParams['route'] || '/';
Redirect
if (this.returnUrl) {
this.router.navigate([this.returnUrl]);
} else {
this.router.navigate(['/']);
}
The problem I have in when the url has parameters in it, for example:
Redirect URL is
'/survey/finish?key=7krmpqpC0P&mind=Akkoord&companyNumber=%5B%5BQ2%5D'
As a result I get the error
Error: Cannot match any routes. URL Segment: 'survey/finish%3Fkey%3D7krmpqpC0P&mind%3DAkkoord&companyNumber%3D%255B%255BQ2%255D'
How can I correctly redirect to the given string?
So http://localhost:4200/survey/finish?key=7krmpqpC0P&mind=Akkoord&companyNumber=%5B%5BQ2%5D
My route looks like thid
{
path: 'survey/finish',
component: CallbackComponent,
canActivate: [AuthGuard]
}