Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angularjs ng-class

ng-class is not working with multiple condition. Apply a class when both conditions are true

Here open and active class should apply when childActive is equal to header and list items is not empty

<li ng-class="{'open':list.items.length&&childActive==header,
'active':list.items.length&&childActive==header}"
         ng-repeat="list in listEntities">
like image 482
Rohit Avatar asked Nov 27 '25 18:11

Rohit


1 Answers

You have some other issue. The following, with multiple conditions, works:

<input ng-model="highlightEven" type="checkbox">
<div ng-repeat="item in ['a', 'b', 'c', 'd']"
     ng-class="{even: $index % 2 === 0 && highlightEven}">{{item}}</div>

plunker

like image 90
New Dev Avatar answered Nov 29 '25 08:11

New Dev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!