Search code examples
angularjsng-class

How to mix this this two ng-class sentences


I have this two ng-class sentences. How can I mix them into one:

ng-class="['step-0' + main.activeConnectStep]"

ng-class="{'active': main.activeConnectStep > 0 }"


Solution

  • Using array notation:

    ng-class="['step-0' + main.activeConnectStep, main.activeConnectStep > 0 ? 'active' : '']"