使用ng-if的ng-repeat($ last)元素

时间:2015-10-21 10:16:42

标签: angularjs dom angularjs-ng-repeat

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>

我不想生成&#34;选择&#34;柱。代码工作正常,但当有条件的类适用于表格时,会显示一个空白列,即&#34;选择&#34;

以便如何在html DOM中删除此空白列?

1 个答案:

答案 0 :(得分:7)

你可能想写

userID

而不是

    <thead>
       <tr>
          <td ng-if="!$last" ng-repeat="header in headerList">
             {{header}}
          </td>
       </tr>
    </thead>