Reputation: 2227
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?
Upvotes: 1
Views: 59
Reputation: 4475
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
Upvotes: 1
Reputation: 533
Try this:
<td><button type="button" id="buttonBuy" ng-disabled="flight.AvailableSits === 0">Kup bilet!</button></td>
Upvotes: 2