单击禁用某些情况

时间:2018-07-09 20:13:54

标签: angular

<div [ngClass]="{'seat-reserve' : isSpotSelected(i, j), 'seat-busy inner-busy' : spot === 1 }" 
     class="inner" 
     *ngFor="let spot of place; let j = index" 
     (click)="togglePlace(i, j)">
  <span [hidden]='isSpotSelected(i, j) || spot === 1' class="content">{{j+1}}</span>
</div>

仅当!! == 1时才是可能的调用click方法,我想知道该调用方法是否始终存在,当!! == 1时返回0

1 个答案:

答案 0 :(得分:1)

如果您只想在某些情况下启用点击,则可以执行以下操作。

(click)="condition ? FunctionToBeExecuted : false"