Reputation: 1730
There is two classes should be applied to the same div:
<div [ngClass]="['class_01_'+someVar, {'class_02': isSelected}]><div>
I get the error:
Error: NgClass can only toggle CSS classes expressed as strings, got [object Object]
How to use conditional class and class with variable with ngClass in Angular?
Upvotes: 0
Views: 1360
Reputation: 29355
you can't really do it with ngClass
alone given what you're trying to do. You'll need to do it with separate ngClass
and class
directives like:
<div [ngClass]="'class_01_'+someVar" [class.class_02]="isSelected"><div>
Upvotes: 3