I have a div
with a class baz
. If a condition is fulfilled, an additional class should be applied to it named qux
. Right now I'm doing it so:
<div [class]="(bar == 'foo')?'baz':'baz qux'">
I'd like to know if there's a better solution, as this one can get quite redundant for elements having not only one (baz
) but multiple default classes. In that case, all those default classes must be written twice in the code.