Add custom attribute for rows when using ngfor

Viewed 54

I have a table definition like this

<tr *ngFor="let pl of pEpics">
    <td>{{pl.WiId}}</td>
    <td>{{pl.Title}}</td>
    <td>{{pl.ProjectCode}}</td>
    <td>{{pl.Domain}}</td>
    <td>
       <span class="badge bg-primary">ADO : {{pl.AdoStatus}}</span>
       <span class="badge bg-warning">KIP : {{pl.KipStatus}}</span>
    </td>
</tr>

But for every row, I need to add a value attribute like this

<tr *ngFor="let pl of pEpics" value="here I need the pl.id"`>

Here I need pl.id

Could you please help to get that attribute with id as value?

1 Answers

Here is how is it done with Angular:

<tr *ngFor="let pl of pEpics" [attr.value]="pl.id"`>
Related