I’m trying to conditionally apply an attribute based on whether a function returns true or false like so:
`<button [attr.secondary]=“isBoosted() ? ‘’: null” full large (click)=“boost()”>
Boost
`
The function isBoosted() returns true, and the attribute is inserted as I’d expect, but the classes that go with the attribute aren’t added so the button doesn’t change colour.
<button [outline]="selectedBell.away" class="i-am-home-button">I Am Home</button>
<button [outline]="!selectedBell.away" class="i-am-out-button">I Am Out</button>
Now if I add a second attribute to the button, say ‘secondary’, the later is not taken into account if the expression for the outline attribute is true:
<button [outline]="selectedBell.away" secondary class="i-am-home-button">I Am Home</button>
<button [outline]="!selectedBell.away" secondary class="i-am-out-button">I Am Out</button>
So the button can have ‘outline’ and ‘secondary’ but ‘secondary’ alone.