What is the best way to add an ng class with one difficult condition

How can I integrate both ng classes

ng-class="{removeBtn:'selected'}[resource.check_added_to_plan]" && ng-class="'lastSpan':($index+1)%3==0}"

If resource.check_added_to_plan is "removeBtn", then I need to add a "selected" class

thank

+4
source share
1 answer

I'm really not sure what you are trying to achieve, but you need to fix the syntax errors and do something like this:

ng-class="{removeBtn: resource.check_added_to_plan, lastSpan: ($index+1)%3==0}"

So, in the form class1: condition1, class2: condition2, etc...

+2
source

Source: https://habr.com/ru/post/1532767/


All Articles