actual path router link code example

Example 1: call a function whenever routerlink is clicke angular

<a class="nav-link" [routerLink]="['/home']" (click)="doSomeLogic()">Home</a>

Example 2: angular absolute routerlink

/*
If the first segment begins with /, the router will look up the route from the root of the app.
If the first segment begins with ./, or doesn't begin with a slash, the router will instead look in the children of the current activated route.
And if the first segment begins with ../, the router will go up one level.