I want to check classname which the closest parent of the clicked element in angular 6?
HTML
<div class="parent-element selected" (click)="checkClass($event)">
<ul>
<li><a>Link-1</a></li>
<li><a>Link-2</a></li>
<li><a>Link-3</a></li>
</ul>
</div>
ANGULAR
checkClass(element) {
return element.target.classList.contains('selected');
}
if I check the classname by using "checkClass" function, it doesn't always give the right result, because there is a possibility of clicked element other than a parent. So I want to first find the closest parent of the clicked element and than check the classname. How can I do that?