Created
March 14, 2017 02:55
-
-
Save P1xt/7f95b00da3a5346dbd6d8a9e2213ad58 to your computer and use it in GitHub Desktop.
Angular 2 *ngFor loop illustrating looping through an array of objects to populate an html table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section class="leader-table"> | |
<h2>All Time Leaderboard</h2> | |
<table class="table-hover table-striped"> | |
<thead> | |
<tr> | |
<th colspan="2">Camper</th> | |
<th>Points in past 30 days</th> | |
<th>All time Points</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr *ngFor="let camper of campers"> | |
<td cellpadding="0" cellspacing="0" class="avatar-cell"><img class="avatar" src="{{camper.img}}" alt="camper avatar"></td> | |
<td>{{camper.username}}</td> | |
<td>{{camper.recent}}</td> | |
<td>{{camper.alltime}}</td> | |
</tr> | |
</tbody> | |
</table> | |
</section> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment