Skip to content

Instantly share code, notes, and snippets.

@CoreProgramm
Created April 16, 2020 14:44
Show Gist options
  • Save CoreProgramm/dea918ba30c6318ffda997c2c24f7f14 to your computer and use it in GitHub Desktop.
Save CoreProgramm/dea918ba30c6318ffda997c2c24f7f14 to your computer and use it in GitHub Desktop.
Angular ngFor trackBy
<table>
<thead>
<tr>
<th>Customer ID</th>
<th>Name</th>
<th>Address</th>
<th>Phone</th>
<th>Email</th>
<th>Gender</th>
<th>Is First</th>
<th>Is Last</th>
</tr>
</thead>
<tbody>
<tr *ngFor='let cust of customers; let isFirst = first; let isLast = last'>
<td>{{cust.cust_code}}</td>
<td>{{cust.cust_name}}</td>
<td>{{cust.Cust_address}}</td>
<td>{{cust.Cust_phone}}</td>
<td>{{cust.Cust_email}}</td>
<td>{{cust.Cust_gender}}</td>
<td>{{isFirst}}</td>
<td>{{isLast}}</td>
</tr>
<tr *ngIf="!customers || customers.length==0">
<td colspan="7">
No Customer to display
</td>
</tr>
</tbody>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment