I have the following code:
import { Component, OnInit, OnDestroy } from "@angular/core";
@Component({
selector: 'sidebar-component',
templateUrl: './sidebar.component.html'
})
export class SideBarComponent implements OnInit, OnDestroy {
constructor() {}
ngOnInit(): void {
window["isSideBarElement"] = this.isSideBarElement;
}
ngOnDestroy(): void {}
private isSideBarElement(event): boolean{
let element: HTMLElement = event.target as HTMLElement;
//mising code check if the target of the event is a child of the component
}
private getDOMElement(): HTMLElement{
return document.getElementsByTagName("sidebar-component")[0] as HTMLElement;
}
}
In the function isSideBarElement
I want to check if the target of the event is a child of the component.
Any sugestions?