Guest User

Untitled

a guest
Jan 6th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. # Component adds class to itself
  2.  
  3. When defining a component you can define a class (and other attribute) on its own host element.
  4.  
  5. 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.
  6.  
  7. This can be done with the `@HostBinding`
  8.  
  9. ```
  10. export class MyComponent {
  11.  
  12. @HostBinding('attr.class') cssClass='my-component-class'
  13.  
  14. }
  15. ```
Add Comment
Please, Sign In to add comment