-1

I am using angular 7 to navigate the app to https:www.google.com,

constructor( public router: Router ) {
  this.router.navigateByUrl("https://www.google.com");
}

but it gives me the error saying

core.js:15724 ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'https:'
Error: Cannot match any routes. URL Segment: 'https:'
    at ApplyRedirects.push../node_modules/@angular/router/fesm5/router.js.ApplyRedirects.noMatchError (router.js:2469)

any way to pass it around?

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
user824624
  • 7,077
  • 27
  • 106
  • 183

1 Answers1

2

You cannot use the router service to navigate to an external link.

You can use: window.location.href = 'some-url'

ionut-t
  • 1,121
  • 1
  • 7
  • 14