I am trying to attach click event to anchor tags (coming from ajax) and block the default redirection. How can I do it in angular ?
You just need to add !! before your click method handler call: (click)="!!onGoToPage2()". The !! will prevent the default action from happening by converting the return of your method to a boolean. If it's a void method, then this will become false.
!!
(click)="!!onGoToPage2()"
void
false