angular ng-class if-else expression
I'm using angularjs ng-class at the following way: <div class="bigIcon" data-ng-click="PickUp()" ng-class="{first:'classA', second:'classB', third:'classC', fourth:'classC'}[call.State]"/> and I wondered if I can use if-else expression, can I do something similar to this: <div class="bigIcon" data-ng-click="PickUp()" ng-class="{first:'classA', second:'classB', else:'classC'}[call.State]"/> meaning whenever call.State different from first or second use classC and not specify each value. thanks! Use nested inline if-then statements ( Ternary Operators ) <div ng-class=" ... ? 'class-1' : ( ... ?