1

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?

2 Answers 2

2

Try this:

<td><button type="button" id="buttonBuy" ng-disabled="flight.AvailableSits === 0">Kup bilet!</button></td>
Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.