[英]ng-click is fired even when ng-disabled is true for checkbox
ng-click is fired even when ng-disabled is true. 即使ng-disabled为true,也会触发ng-click。 How to prevent this happening.
如何防止这种情况发生。
<div class="fila">
<div class="seccion">
<div class="asiento">
<input ng-checked="seatLayout[0].reserved " ng-disabled="seatLayout[0].reserved || result.length == parseInt(maxSeats) "
type="checkbox" value="None" id="asiento1" name="check"/>
<label ng-class="{'selected' : seatLayout[0].reserved == true, 'notselected' : seatLayout[0].reserved == false}"
ng-click="addSeat(seatLayout[0])"
for="asiento1">{{seatLayout[0].id}}</label>
</div>
</div>
</div>
You can add the ng-disabled condition to ng-click like this: 您可以将ng-disabled条件添加到ng-click中,如下所示:
ng-click="(seatLayout[0].reserved || result.length == parseInt(maxSeats) ) || addSeat(seatLayout[0])"
This will prevent the click on the label when the condition is true. 当条件为真时,这将防止单击标签。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.