I need to get father after a click: i have this code html:
<button mat-icon-button (click)="download($event)">
the code html generate is this:
<button _ngcontent-wsc-c153="" mat-icon-button="" class="" aria-label="">
<mat-icon _ngcontent-wsc-c153="" role="img" alt="download" class="" aria-hidden="true" data-mat-icon-type="font" aria-describedby="cdk-describedby-message-2" cdk-describedby-host="0">download_for_offline</mat-icon><!---->
</button>
in my ts file I do this:
download(event) {
console.log(event);
How I can get from event the father because event.target
is mat-icon
but I need get the father button?
2
Answers
Try the following:
Note: The term "father" is not commonly used in web development to refer to the parent element. Use the term "parent" instead.
You can use parentElement.