Using the HostListener directive, I am listening for the click event on elements of the DOM.
@HostListener('click', ['$event.target']) onClick(e) {
console.log("event", e)
}
Upon clicking a button tag, the "e" object contains the following:
<button _ngcontent-abr-c111 type="button" class="close ng-tns-c111-3">x</button>
When I iterate through the object, it displays the following:
const objectList = Object.keys(e).map(k => (
console.log("key", k)
));
// result = key __zone_symbol__clickfalse
In my code, I want to check if the button element has the "close" class, and then perform different actions based on that condition. How can I achieve this? Thank you."