I want to redirect to another link using router link in angular 7 but localhost:4200/dashboard is getting appended to the link to which I want to redirect.
<a [routerLink]="https://google.com">Google</a>
When I click on Google, It should redirect to https://google.com but localhost:4200/dashboard/https://google.com is being called.
routerLink
is for internal routing of Angular. If you want to navigate to an external URL, just use href
with a
tag:
<a href="https://google.com">Google</a>
RouterLink: https://angular.io/api/router/RouterLink