Is there a way to use @HostBinding dynamically when we trigger mouseeneter/mouseleave event on child element in a template, that is:
in template.component.html
<div class="test-btn"
(mouseenter)="mouseenter()"
(mouseleave)="mouseleave()">
</div>
and in template.component.ts
@HostBinding('class') classes = this.getMouseClass();
where:
private getStateClass() {
const mouse = this.mouseState ? 'mouse-enter' : 'mouse-leave';
return `${mouse}`;
}
mouseenter() {
this.mouseState = true;
}
mouseleave() {
this.mouseState = false;
}