Skip repeat for some columns in ng-repeat

Viewed 1415

I wanted to have a table like this using angular repeat

HTML

<table border="1">
  <tr>
    <th>Month</th>
    <th>Savings</th>
    <th>Savings for holiday!</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
    <td rowspan="2">$50</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>

  <tr>
    <td>January</td>
    <td>$100</td>
    <td rowspan="2">$50</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</table>

I have written an Angularjs code for the above as follows.

<table border="1">
  <tr>
    <th>Month</th>
    <th>Savings</th>
    <th>Savings for holiday!</th>
  </tr>
  <tr ng-repeat="row in rows">
    <td>{{row.month}}</td>
    <td>{{row.savings}}</td>
    <td rowspan="2">{{row.holidaysavings}}</td>      
  </tr> 
</table>

The td with rowspan gets repeated using ng-repeat which is not required. How can I avoid this?

2 Answers
Related