@HostBinding with a variable class in Angular
This can't be made variable.
What you can do instead is to bind to the class property directly
@HostBinding('class') classes = 'class1 class2 class3';
If you have a limited number of classes you can conditionally add each one:
@HostBinding('class.c1') get c1 () { return this.useC1; }
@HostBinding('class.c2') get c2 () { return this.useC2; }
Note that .c1
and .c2
need to be defined outside the component.
Plunker