In my Angular app, I have a component that triggers an event when I click on it. I can get the elementRef from this event, but I want to test whether that element has a certain class applied to it. So my code looks like this:
<component1 [class.class1]="this.condition">
and
@HostListener('document:mousedown', ['$event'])
onMouseDown(event: MouseEvent): void {
let elementRef = this.elementRef;
// I want to know if 'elementRef' has class 'class1' applied to it.
}
I want to do something like elementRef.class1. Does anyone know how to approach this?