I have developed an Angular 2 application in which I am trying to apply a CSS class using ngClass
. I have stored the class name in a variable className
and tried below code to apply:
First way
[ngClass]={'{{className}}': expression}
Second way
[ngClass]= {className: expression}
But neither of them worked.
update
or just
Plunker example
original (works only in Dart)
will work fine when
expression
returnstrue