So I've got a table looking like this (AngularJS):
<tr id="table">
<td style="text-align: center">{{flight.FlightFrom}}</td>
<td style="text-align: center">{{flight.FlightTo}}</td>
<td style="text-align: center">{{flight.Departure}}</td>
<td style="text-align: center">{{flight.Arrival}}</td>
<td style="text-align: center">{{flight.Price | currency: "PLN "}}</td>
<td style="text-align: center" id="sits">{{flight.AvailableSits}}</td>
<td><button type="button" id="buttonBuy">Kup bilet!</button></td>
</tr>
And I want to get to the {{flight.AvailableSits}}
value, to check if its equal to 0, and if it is, then I want to disable the Buy button. How can I do it?
尝试这个:
<td><button type="button" id="buttonBuy" ng-disabled="flight.AvailableSits === 0">Kup bilet!</button></td>
You can use the ng-show
directive on the button.
<button type="button" id="buttonBuy" ng-show="flight.AvailableSits">Kup bilet!</button>
This will show the button only when there are available seats
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.