In AngularJS Tables we can show repeatable data. Using ng-repeat directive we can draw table easily. See the below example how to use ng-repeat in table.
Table data is normally repeatable by default and ng-repeat directive can be used perfectly to create table easily.
<table>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr ng-repeat="x in user">
<td>{{ x.name }}</td>
<td>{{ x.age }}</td>
</tr>
</table> Read Also: HTML DOM – AngularJS
OutPut:
| Name | Age |
|---|---|
| John Doe | 25 |
| Jane Doe | 21 |
| Robert Stuart | 35 |
To sort the table, add an orderBy filter:
<tr ng-repeat="x in user | orderBy : 'name'">
<td>{{ x.name }}</td>
<td>{{ x.age }}</td>
</tr> In order to display the table index, use <td> with $index:
<tr ng-repeat="x in user">
<td>{{ $index + 1 }}</td>
<td>{{ x.name }}</td>
<td>{{ x.age }}</td>
</tr> For example:
| No. | Name | Age |
|---|---|---|
| 1 | John Doe | 25 |
| 2 | Jane Doe | 21 |
| 3 | Robert Stuart | 35 |
When you are looking to apply for a mortgage the one thing that most people…
Once you've memorized basic blackjack strategy, it's time to delve deeper into the game. Advanced…
Yoga is no longer just a physical practice. Yoga is popular as a lifestyle practice.…
Best Crypto Sign-Up Bonuses in India 2026: Ranked & Compared Every exchange claims to have…
One of the world's busiest travel hubs, New York City relies heavily on coach bus…
Whether large scale or small scale, many businesses want to market their services or products…
View Comments
Makes sense. I just wanted to throw it out there in case there was some part I didn't understand. Thanks.