I have successfully used @HostBinding
in my Angular 6 app to apply properties to the host component, as in applying a class when a variable is true:
@HostBinding('class.compact-ui') isCompact;
Now, however, I need to assign one of 4 possible classes based on the model of a select menu. For example, user can red
, blue
, or green
.
I suppose I can use multiple host bindings for when any of the colors are true:
@HostBinding('class.green-ui') uiColor === 'green';
But that seems wrong. What's the proper way to do this?