I am trying to use anchor tag with href in my Angular 7 app. When I click on the link the url changes in the browser but the page doesn't get navigated to. It works if I put target="_self" so this works
<a href="/abcd" target="_self">Abcd</a>
but this does not work only the url changes in the browser but nothing happens
<a href="/abcd">Abcd</a>
where as if I use Angular routing and use RouterLink it works.
<a routerLink="/abcd" routerLinkActive="active">Abcd</a>
Can anyone explain the behaviour please.
<a routerLink="/abcd" routerLinkActive="active">Abcd</a>
you should put<router-outlet>
. From this, we can tell we are using routes. – Dhanushka sasankahref
it's to call page which is not in your applicationrouterLink
is the inverse – user10863293