I have following table with td written using ng-repeat:

```
<div class="row">
            <div class="col-sm-10">
              <table class="customAttributesTable">
                <tbody>
                <tr>
                  <td class="col-sm-2" ng-repeat="customField in basicInfoCustomFields">
                    <label for="customer">{{ 'CUSTOMER' | translate }} </label>
                    <input type="text" ng-model="order.customer.name"  class="form-control" id="customer" />
                  </td>
                </tr>
                </tbody>
              </table>
            </div>
          </div>

```

I would like to ask how can i do following:

Max count of columns in row can be 5, if items count is higher than 5 table should to contain new row. 

If count of items in row is lower than 5 are missing values to count 5 replaced by tag:

```
  <td class="col-sm-2">

  </td>

```

Because the data for the table are stored as the Array of the objects i have to use modulo operator to do this.

Have somebody the idea, how can i do it please?

Many Thanks for any advice. 

**EDIT:**

Based on the anpsmn reply i tried following:

```
<!-- CUSTOM FIELDS -->
          <div class="row">
            <div class="col-sm-10">
              <table class="customAttributesTable">
                <tbody>
                <tr ng-switch on="$index%5==0" ng-repeat="customField in basicInfoCustomFields">
                  <td ng-repeat="i in [0,1,2,3,4]" class="col-sm-2" >
                    <label for="customer">{{basicInfoCustomFields[$parent.$index+i].label}} </label>
                    <input type="text" ng-model="basicInfoCustomFields[$parent.$index+i].value"  class="form-control" id="customer" />
                  </td>
                </tr>
                </tbody>
              </table>
            </div>
          </div>
          <!-- !!CUSTOM FIELDS -->

```

But it producing result like this (scope array has only 3 items):

![enter image description here](https://i.stack.imgur.com/zY2qD.png)