<p>During a recent Codementor session, a user asked about how to use nested ng-repeats to build a HTML table using both dynamic tables and rows. </p><p>I clarified the syntax of aliasing inside of the angulars directives. </p><p><br><strong>Quick Tip: </strong></p><pre><code class="language-javascript">//contoller
$scope.headers = ['header1','header2', 'header3'];
$scope.data = [
{
'header1': 'data1-1',
'header2': 'data1-2',
'header3': 'data1-3'
},
{
'header1': 'data2-1',
'header2': 'data2-2',
'header3': 'data2-3'
}
//...
]
</code></pre><pre><code class="language-html"><table>
<thead>
<tr>
<th ng-repeat="field in headers">{{header}}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in data">
<td ng-repeat="field in headers">{{ row[field] }}</td>
</tr>
</table></code></pre><p> </p><p> </p>