I'm trying to use *ngFor to generate a table that is collapsible. Doing this though requires a unique id matching both the tr element with the data-target attribute for the collapsible to work. My plan is to use the User's ID from the backend as this unique identifier. I can't seem to find the correct syntax for this.
Below is the code I've tried, but I know this isn't the correct syntax. the "data-target" attribute is what I need the help with.
<table class="table table-condensed table-striped">
<thead>
<tr>
<th></th>
<th>Fist Name</th>
<th>Last Name</th>
</tr>
</thead>
<tbody>
<tr
data-toggle="collapse"
data-target="#demo[[user.id]]"
class="accordion-toggle"
*ngFor="let user of viewUsers"
>
<td>
<button class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-eye-open"></span>
</button>
</td>
<td>{{ user.firstName }}</td>
<td>{{ user.lastName }}</td>
</tr>
<tr>
<td colspan="12" class="hiddenRow">
<div class="accordian-body collapse" id="demo[[user.id]]">
<table class="table table-striped">
<thead>
<tr class="info">
<th>Job</th>
<th>Company</th>
<th>Salary</th>
<th>Date On</th>
<th>Date off</th>
<th>Action</th>
</tr>
</thead>