Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Component adds class to itself
- When defining a component you can define a class (and other attribute) on its own host element.
- For example if you define the `<my-component></my-component` component, you can define it to have a class like `<my-component class="my-component-class">` directly from compoent code. So you are not dependent on the "user" of this component to define the class.
- This can be done with the `@HostBinding`
- ```
- export class MyComponent {
- @HostBinding('attr.class') cssClass='my-component-class'
- }
- ```
Add Comment
Please, Sign In to add comment