[英]Hide a component on click of mat-button and display other one Angular 9
[英]Angular disable click event for mat-button
我在垫子表中有一个带有按钮的列。 根据一个值,我检查按钮是否应该启用或禁用并且工作正常。 问题是如果用户点击一个禁用的按钮,它会得到一个错误。 如何禁用禁用按钮的单击事件?
<ng-container matColumnDef="download">
<th mat-header-cell *matHeaderCellDef>download</th>
<td mat-cell *matCellDef="let element">
<mat-button [disabled]="isDisabled(element.status)" (click)="download(element.value)"> download </mat-button>
</td>
</ng-container>
<ng-container matColumnDef="download">
<th mat-header-cell *matHeaderCellDef>download</th>
<td mat-cell *matCellDef="let element">
<mat-button [disabled]="isDisabled(element.status)" (click)="!isDisabled(element.status) && download(element.value)"> download </mat-button>
</td>
</ng-container>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.