Angular 7 References/ Core
References

@HostBinding

This is the documentation for Angular 7.
You can switch to the latest version Angular 10.

Binds a host element property to a directive/component property.

Example

export class MyComponent {
  @HostBinding('class.valid') isValid;
}

Or use getter for binding:

export class MyComponent {
  @HostBinding('class.error') get isError() {
    ...
  }
}
Links & Tutorials

Options

hostPropertyName#

hostPropertyName?: string
Property name.