Reputation: 3171
In my cshtml view I have the following table:
<table>
<thead>
<tr><th>Test</th></tr>
</thead>
<tbody>
<tr ng-repeat="label in labels">
<td>{{label.id}}</td>
</tr>
</tbody>
And when I view the page and inspect the table element in my browser only the table headings are displayed and no rows. Applying ng-repeat seems to comment out the rows automatically as below:
<table class="ng-scope">
<thead>
<tr><th>Test</th></tr>
</thead>
<tbody>
<!-- ngRepeat: label in labels -->
</tbody>
</table>
when I remove ng-repeat="label in labels" and apply a static value in the row cell the row is not commented and displays just fine.
Does anyone knows what could be causing this behaviour?
Upvotes: 0
Views: 660
Reputation: 2156
Upon compilation angular automatically adds the ngRepeat comment to the HTML, in order to indicate that below this comment, the repeated elements will be displayed.
The reason why your tbody doesn't contain any rows, is because your $scope.labels object is empty.
Upvotes: 2