I have a <myComponent ></myComponent> and I want give class to myComponent?
This doesnt worked `<myComponent class="my-class"></myComponent>`
How can I do that?
class MyComponent {
@HostBinding('class.my-class')
isMyClass:boolean = true;
}
Don't think that will work but there are easy workarounds:
If you want to style the placement/color etc of your component:
Best workaround is to place your <myComponent></myComponent> inside a <div> and apply the class to that div
If you want to style the contents of your component:
adding styleUrls in your Component and styling your content with a css file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With