Angularjs 有角重复的奇怪行为
在我的cshtml视图中,我有下表:Angularjs 有角重复的奇怪行为,angularjs,angularjs-ng-repeat,Angularjs,Angularjs Ng Repeat,在我的cshtml视图中,我有下表: <table> <thead> <tr><th>Test</th></tr> </thead> <tbody> <tr ng-repeat="label in labels"> <td>{{label.id}}</td> </tr> </tbody> 试
<table>
<thead>
<tr><th>Test</th></tr>
</thead>
<tbody>
<tr ng-repeat="label in labels">
<td>{{label.id}}</td>
</tr>
</tbody>
试验
{{label.id}
当我在浏览器中查看页面和检查表格元素时,只显示表格标题,不显示行。应用ng repeat似乎会自动注释掉行,如下所示:
<table class="ng-scope">
<thead>
<tr><th>Test</th></tr>
</thead>
<tbody>
<!-- ngRepeat: label in labels -->
</tbody>
</table>
试验
当我删除ng repeat=“label in labels”并在行单元格中应用静态值时,该行没有注释,显示得很好
有人知道是什么导致了这种行为吗?编译后,angular会自动将ngRepeat注释添加到HTML中,以表明在该注释下面,将显示重复的元素
tbody不包含任何行的原因是$scope.labels对象为空。您可以发布javascript吗?看起来标签为空或未定义。