I am using ngClass (Angular 2) to load a string of classes if condition is true and other string of classes if the condition is false!
Here is the code:
<label [ngClass]="{'btn btn-success m-btn m-btn--pill': value==2, 'btn btn-outline-success m-btn m-btn--pill': value!=2}" >
No Issue (but same code as first part in the ngClass):
The second part works good where the condition is value!=2
and the class string to be loaded is btn btn-outline-success m-btn m-btn--pill
Issue:
The first part where the condition is value==2
and classes string to be loaded is btn btn-success m-btn m-btn--pill
but the only class loaded (out of many available in the string) is btn-success
.
I am unable to get why ngClass is loading only one class while leaving others classes in the string!
Can some one please let me know if I'm doing something wrong or it is a bug in angular 2?