DEV Community

Angga Lesmana
Angga Lesmana

Posted on

1

create variable data in button and share to another button

I have one simple case to create variable in button html share into another button

<td style="width: 3rem">
              <button
                mat-icon-button
                type="button"
                [matMenuTriggerData]="{ data: data }"
                class="cell-action"
                [matMenuTriggerFor]="actionsMenu"
                (click)="id = data.id"
              >
                <mat-icon
                  style="font-size: 24px"
                  [icIcon]="icMoreHoriz"
                ></mat-icon>
              </button>
            </td>
Enter fullscreen mode Exit fullscreen mode

see into [matMenuTriggerData] = {data: data}

  <ng-template let-data="data" matMenuContent>
    <button mat-menu-item [routerLink]="'./>
      <mat-icon [icIcon]="icPageView"></mat-icon>
      <span>Detail</span>
    </button>
    <!-- <button mat-menu-item (click)="dd(id)">
      <mat-icon [icIcon]="icArrowDownward">Canceled</mat-icon>
      <span>Unduh</span>
    </button> -->
    <!-- <button *ngIf="statusDelete"  mat-menu-item (click)="alertDialog(id)">
      <mat-icon [icIcon]="icDelete"></mat-icon>
      <span >Hapus</span>
    </button> -->
    <button *ngIf="data.status != 'Canceled'" mat-menu-item (click)="alertDialog(id)">
      <mat-icon [icIcon]="icDelete"></mat-icon>
      <span >Hapus</span>
    </button>
  </ng-template>
Enter fullscreen mode Exit fullscreen mode

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay