title: AngularJS Loops and Formatting
body: <p>very new to AngularJS so please forgive me if this is a stupid question.</p>
  
  <p>I need to output my data in a grid like format (using Ionic) and i need to have a div for a row and separate divs for columns, like this</p>
  
  <pre><code>&lt;div class="row"&gt;
      &lt;div class="col-33"&gt;Item 1&lt;/div&gt;
      &lt;div class="col-33"&gt;Item 2&lt;/div&gt;
      &lt;div class="col-33"&gt;Item 3&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="row"&gt;
      &lt;div class="col-33"&gt;Item 4&lt;/div&gt;
      &lt;div class="col-33"&gt;Item 5&lt;/div&gt;
      &lt;div class="col-33"&gt;Item 6&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>My data is within a list, much like this.</p>
  
  <pre><code>    $scope.images = [];
      $scope.images.push({text: 1});
      $scope.images.push({text: 2});
      $scope.images.push({text: 3});
      $scope.images.push({text: 4});
      $scope.images.push({text: 5});
      $scope.images.push({text: 6});
  </code></pre>
  
  <p>How can i use the $scope.images list to output my as a grid?</p>
  
  <p>The closest i have got is below, but it doesnt work.</p>
  
  <pre><code>&lt;ion-content&gt;
      &lt;div class="list list-inset" ng-init="myIndex = 0"&gt;
  
          {{myIndex }} : {{ images.length }}
  
          &lt;div ng-repeat="myIndex &lt; images.length" &gt;
  
              &lt;div class="row" ng-repeat="colIndex in [0, 1, 2]" ng-init="colIndex = 0"&gt;
  
                  &lt;div ng-show="myIndex + colIndex &lt; images.length" class="col-33" ng-init="myIndex = myIndex + 1"&gt;
  
                      {{ myIndex }}:{{ colIndex }}:{{myIndex + colIndex}}:{{ images[myIndex + colIndex].text}}
  
                  &lt;/div&gt;
  
              &lt;/div&gt;
  
          &lt;/div&gt;
  
      &lt;/div&gt;
  
  &lt;/ion-content&gt;
  </code></pre>
  
  <p>Is there such a thing as a while loop?  I was hoping i could increase the $index variable if i used ng-repeat="item in images", but not sure how to do that either.</p>
  
  <p>Thanks in advance</p>