从路由器 link 中删除 localhost:4200/xxx
Remove localhost:4200/xxx from router link
我想在 angular 7 中使用路由器 link 重定向到另一个 link,但是 localhost:4200/dashboard 正在附加到 link我想重定向。
<a [routerLink]="https://google.com">Google</a>
当我点击 Google 时,它应该重定向到 https://google.com 但是
localhost:4200/dashboard/https://google.com 正在调用。
routerLink
用于 Angular 的内部路由。如果您想导航到外部 URL,只需使用 href
和 a
标签:
<a href="https://google.com">Google</a>
正如名称 routerLink
所暗示的那样,它适用于在您的应用程序路由中定义的内部 urls。请使用此 url 查看如何实现自定义。
https://medium.com/@adrianfaciu/using-the-angular-router-to-navigate-to-external-links-15cc585b7b88
我想在 angular 7 中使用路由器 link 重定向到另一个 link,但是 localhost:4200/dashboard 正在附加到 link我想重定向。
<a [routerLink]="https://google.com">Google</a>
当我点击 Google 时,它应该重定向到 https://google.com 但是 localhost:4200/dashboard/https://google.com 正在调用。
routerLink
用于 Angular 的内部路由。如果您想导航到外部 URL,只需使用 href
和 a
标签:
<a href="https://google.com">Google</a>
正如名称 routerLink
所暗示的那样,它适用于在您的应用程序路由中定义的内部 urls。请使用此 url 查看如何实现自定义。
https://medium.com/@adrianfaciu/using-the-angular-router-to-navigate-to-external-links-15cc585b7b88