用ng-if重复($last)元素


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>

我不想生成"Select"列。代码工作正常,但当border类应用于表一个空白列显示,即"选择"

所以我怎么能删除这个空白列在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>

最新更新