I have created a table, and I am able to generated a new row to the table on calling of addRow() function. generated button in the row is not able to call the myFunc(). how can I achieve that.
addRow(){
let table = document.getElementById("tableData");
let rowcount = table.rows.length;
let row = table.insertRow(rowcount);
row.insertCell(0).innerHTML= rowcount;
row.insertCell(1).innerHTML= 'some fake data';
row.insertCell(2).innerHTML= '<button (click)="myFunc()">click</button>';
}
myFunc(){
alert()
}
<table id="tableData" border="1" >
<tr>
<th>S.No.</th>
<th>Name</th>
<th>Operation</th>
</tr>
</table>