How to add “class” to host element?
This way you don’t need to add the CSS outside of the component: @Component({ selector: ‘body’, template: ‘app-element’, // prefer decorators (see below) // host: {‘[class.someClass]’:’someField’} }) export class App implements OnInit { constructor(private cdRef:ChangeDetectorRef) {} someField: boolean = false; // alternatively also the host parameter in the @Component()` decorator can be used @HostBinding(‘class.someClass’) someField: … Read more