How to have a condition within a [disabled] attribute?

Is it possible to have a condition within a condition for a [disabled] attribute?

This is my attempt at what I’m trying to do for a button:

[disabled]="(second.checkoutHasSupplies() || !second.confirmed) && (!second.confirmedPickUp || !confirmed)"

I want the button to be disabled:

  1. if second.confirmedPickUp is not confirmed
  2. if confirmed is not confirmed
  3. and then only if second.checkoutHasSupplies() is true, then if second.confirmed is not confirmed

I can get numbers 1 and 2 in the list above working, but I can’t seem to figure out how to do number 3. As you can see in my code above, I tried (second.checkoutHasSupples() || !second.confirmed), but that’s not working.

Also I’m sure it’s clear, but just to clarify, I have the second. in front of some of the code because I’m pulling the data from another component. However the string that’s just !confirmed is within this component I’m trying to do this on.

I’m really not sure how to achieve this. Any step-by-step walkthroughs would be appreciated! Thanks!

Source: AngularJS Questions