I dont't know how to add to my component <component></component>
a dynamic class attribute but inside the template html (component.html).
The only solution I found is to modify the item via "ElementRef" native element. That solution seems a little complicated to do something that should be very simple.
Another problem is that CSS has to be defined outside component scope, breaking component encapsulation.
Is there a simpler solution? Something like <root [class]="..."> .... </ root>
inside the template.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…