-1

I want to redirect with Router and added query params but after call function error appears:

"ERROR Error: Uncaught (in promise): Error: Cannot match any routes."

Function is like this:

const url = 'https://test.com' + '?queryParam=' + word;
this.router.navigateByUrl(url);
Just Shadow
  • 10,860
  • 6
  • 57
  • 75

1 Answers1

1

Try the following for navigating within your angular application with query parameters:

this.router.navigate(["/test"], { queryParams: { foo: "bar" }});

if you need to navigate outside your angular application then you could try

window.location.href = 'https://test.com' + '?queryParam=' + word;

Jelle Bruisten
  • 421
  • 6
  • 11