Tengo una tabla en mi archivo html, ¿cómo deshabilito la función onClick en la condición fecha de inicio> fecha actual?
<ng-container matColumnDef="d"> <th mat-header-cell *matHeaderCellDef > Start Date </th> <td mat-cell *matCellDef="let w" (click)="display = false; create(false, w)" title="Cannot start" > {{ w.startDate }} </td> </ng-container>y supongamos que quiero mostrar el título "no se puede iniciar" solo cuando fecha de inicio> fecha actual, ¿cómo podría hacerlo?
Ponga una condición en su lógica de clic
.html
(click)="clicked(w)" [attr.title]="isFuture(w) ? 'Cannot start' : 'Can start'".ts
clicked(w) { if (this.isFuture(w)) { this.display = false; this.create(false, w) } } isFuture(w) { return w.startdate > new Date(); }