-1

I have this:

ng-class="
 filter.page == $index ? 'btn-dark' : 'btn-outline-secondary'
"

Which works.

However, I want to add more classes, depends on different IFs

like this:

ng-class="
 filter.page == $index ? 'btn-dark' : 'btn-outline-secondary';
 $root.t.direction=='rtl' ? 'ml-2' : 'mr-2'
"

But only the last is getting applied.

Raz Buchnik
  • 7,753
  • 14
  • 53
  • 96

1 Answers1

0

Wrapping the conditions between [] as an array:

ng-class="
  [filter.page == $index ? 'btn-dark' : 'btn-outline-secondary',
  $root.t.direction=='rtl' ? 'ml-2' : 'mr-2']
"
Raz Buchnik
  • 7,753
  • 14
  • 53
  • 96