Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@HostBinding with a variable class in Angular

Tags:

angular

I have this code which sets a class on the host:

@HostBinding('class.fixed') true; 

What I would like to do is make this a variable class that I can modify. How can I do this?

like image 603
B Hull Avatar asked Feb 03 '16 04:02

B Hull


1 Answers

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'; 
like image 177
Günter Zöchbauer Avatar answered Sep 29 '22 06:09

Günter Zöchbauer