Issue
I have a table in my html file how do I disable onClick function on condition startdate> currentdate
<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>
and suppose I want to show "cannot start" title only when startdate>current date how could I do that
Solution
Put a condition in your click logic
.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();
}
Answered By - Alexis Deprez
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.