Run custom function before open in new tab

Discussão em 'Angular' iniciado por Thuan Tran, Janeiro 16, 2025.

  1. Thuan Tran

    Thuan Tran Guest

    I am using an <a> tag instead of a button because I need to add the feature that allow user to right click and then open in new tab:

    [​IMG]

    The issue right now is that this tag have an onClick function which simply doesn't run at all when user select open link in new tab. I need this function to run because it would show a warning dialog before navigating to other page. This is the code, any advice would be appreciated!

    <a
    mat-flat-button
    class="action"
    [routerLink]="'/sponsor'"
    [queryParams]="{ id: 'sponsorId', viewPk }"
    [disabled]="isLoading || dataLength === 0 || !isFiltering"
    (click)="onClickNavigateToPageX()"
    >
    <mat-icon svgIcon="graph" class="icon"></mat-icon>
    See graph
    </a>

    Continue reading...

Compartilhe esta Página