When I use ngClass with multiple expressions with common classes, the common class c1 discarded when the expression changes from false to true:
<span [ngClass]="{'c1 c2' : showTwo, 'c1 c3' : showThree, 'c1 c4' : showFour}" ></span>
To overcome this, I have to specify a generic class using the standard class attribute.
<span class="c1" [ngClass]="{'c2' : showTwo, 'c3' : showThree, 'c4' : showFour}" ></span>
Is there a better way to achieve this? or is it a bug with angular2?
source share