I have a running Angular application and want to send the data on click from html template as:
.ts
columns: [
{ label: 'User Name', key: 'Name' },
{ label: 'User Age', key: 'Age' }
]
data: [
{Name: 'John', Age: 12},
{Name: 'Sam', Age: 34},
{Name: 'Jack', Age: 15}
]
onClick(data) {
console.log(data);
}
html
<div *ngFor="let row of data">
<div *ngFor="let column of columns" (click)="onClick(row[column.key])">
{{ row[column.key] }}
</div>
</div>
But, I am not able to fetch the data and getting value as undefined. Please help me on this