when I click on the button I want it to get the information of the line it is on. for example I want to get the information of that line when I click the button in the first line. my web page is as follows
my html code
<table id="news">
<tr>
<th *ngFor="let col of headers">
{{col}}
</th>
</tr>
<tr *ngFor="let new of news">
<td *ngFor="let col of index">
{{new[col]}}
</td>
<td>
<button>Favorite</button>
</td>
</table>
just pass as argument to the function the "new"
<button (click)="yourFunction(new)">Favorite</button>
You can also pass only the index of the column if you declare in the *ngFor let i=index
<!--see the let i=index-->
<tr *ngFor="let new of news; let i=index">
<td *ngFor="let col of index">
{{new[col]}}
</td>
<td>
<button (click)="yourFunction(i)>Favorite</button>
</td>
</tr>