ng-repeat ($last) element with ng-if
11,785
You might want to write
<thead>
<tr>
<td ng-if="!$last" ng-repeat="header in headerList">
{{header}}
</td>
</tr>
</thead>
instead of this
<thead>
<tr ng-repeat="header in headerList">
<td ng-if="!$last">
{{header}}
</td>
</tr>
</thead>
Related videos on Youtube
Author by
pooja shah
Updated on October 20, 2022Comments
-
pooja shah over 1 year
var dataList = [{Id:1,Name: "xyz",Select: true}, {Id:2,Name: "PQR",Select : false }]; var headerList = [{"ID","Name","null"}]
i got this value from server side i can not make any changes in this array list.
My html code is
<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>
I don't want to generate "Select" column. code works propely , but when bordered class applies on table one blank column is display i.e "Select"
so that how can i remove this blank column in html DOM ?
-
murli2308 over 8 yearsI think something wrong in the headerList = [{"ID","Name","null"}]. The object has only properties
-