单击角度2设置td类

时间:2017-11-12 08:41:54

标签: javascript html angular

我有这样的

<table>
    <tbody>
        <tr *ngFor="let row of createRange(seats.theatreDimension.rowNum)">
            <td [ngClass]="{'reserved': isReserved(row, seat)}" id={{row}}_{{seat}} (click)="selectSeat(row, seat)" *ngFor="let seat of createRange(seats.theatreDimension.seatNumInRow)">
            </td>
        </tr>
    </tbody>
</table>

我想在点击时设置 td 'reserved'。 我怎样才能做到这一点?

1 个答案:

答案 0 :(得分:0)

试试这个

<td [ngClass]="{'reserved': isReserved(row, seat)}" id={{row}}_{{seat}} @click="selectSeat(row, seat)" *ngFor="let seat of createRange(seats.theatreDimension.seatNumInRow)">
        </td>