var dataList = [{Id:1,Name: "xyz",Select: true},
{Id:2,Name: "PQR",Select : false }];
var headerList = [{"ID","Name","null"}]
我从服务器端获得了这个值,我无法对此数组列表进行任何更改。
我的html代码是
<table class= "table table-bordered">
<thead>
<tr ng-repeat="header in headerList">
<td ng-if="!$last">
{{header}}
</td>
</tr>
</thead>
<tbody>
<tr ng-repeat="data in dataList">
<td ng-repeat="value in data" ng-if="!$last">
{{value}}
</td>
</tr>
</tbody>
</table>
我不想生成“选择”列。代码工作正常,但是当有边框的类应用于表时,会显示一个空白列,即“选择”
那么我如何删除 html DOM 中的这个空白列?
最佳答案
你可能想写
<thead>
<tr>
<td ng-if="!$last" ng-repeat="header in headerList">
{{header}}
</td>
</tr>
</thead>
而不是这个
<thead>
<tr ng-repeat="header in headerList">
<td ng-if="!$last">
{{header}}
</td>
</tr>
</thead>
关于angularjs - ng-repeat ($last) 元素与 ng-if,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33256682/