You have prevent the default browser behaviour. But you don’t need to create a directive to accomplish that.
It’s easy as the following example:
my.component.html
<a href="" (click)="goToPage(pageIndex, $event)">Link</a>
my.component.ts
goToPage(pageIndex, event) {
event.preventDefault();
console.log(pageIndex);
}