79264722

Date: 2024-12-09 11:04:58
Score: 1.5
Natty:
Report link

Since Angular 19, the use of the host property is recommended (rather than @HostBinding).

So you can do:

@Component({
  selector: 'app-foo',
  template: '...',
  host: {
    '[class.some-class]': 'someClass()',
  },
})
export class FooComponent {
  someClass = computed(() => ...); // works well with signals 💪
}
Reasons:
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: fservantdev