0

I'm looping through an array of items. Each item has a completed value which is either true or false. I have 3 radio buttons.

0 = Show all

1 = Show completed

2 = Show incomplete

I've attempted to hide and show these elements when the radio button changes. Individually, they work. The moment I try to combo the conditions, they stop working. Am i missing something obvious?

[ngClass]="[
  myRadioValue === 0 ? 'block' : '', 
  myRadioValue === 1 && item.completed ? 'block' : 'hidden', 
  myRadioValue === 2 && !item.completed ? 'block' : 'hidden'
]"
Que
  • 957
  • 2
  • 14
  • 35
  • Does this answer your question? [Multiple conditions in ngClass - Angular 4](https://stackoverflow.com/questions/44821875/multiple-conditions-in-ngclass-angular-4) – AlleXyS Dec 09 '20 at 10:13
  • Thanks AlleXyS - I have looked here, which is how I got to where I am. I've managed to get it working now, but it feels backwards. – Que Dec 09 '20 at 10:15

0 Answers0