0
votes

i am using angular material with data table

and putting a button in the last column

when the value from the data that we fetch from the database is "Approve"

then the button becomes disabled how I achieve this

<!-- Star Column -->
    <ng-container matColumnDef="star" stickyEnd>
      <th mat-header-cell class="editbut" *matHeaderCellDef></th>
      <td mat-cell class="editbut" *matCellDef="let element">
        <button mat-raised-button color="primary" (click)="openDialogEdit(element)">Edit</button>
      </td>
    </ng-container>

I am trying to put some ngclass on the mat-row but the value still undefined so we cant add the disabled

[disabled] = "{disabled:row.status == "Approve"}"
1

1 Answers

1
votes

The right syntax is [disabled]="some condition".

So for your case it should be [disabled]="row.status == 'Approve'"

Working demo