title: Reset arrays value inside angular.foreach loop
body: <p>I have an array of empty objects like this:</p>
  
  <pre><code>var a = [ {}, {}, {}, {}, {}, {} ];
  </code></pre>
  
  <p>And an array of properties:</p>
  
  <pre><code>var colors = ["red", "green", "blue"];
  </code></pre>
  
  <p>I need to assign each color in "colors" to every element of "a" array with angular foreach. But the length of "a" array is greater than "colors". I want to assign the colors "by circle" So the result needs to be like this: </p>
  
  <pre><code>var a = [
      {color: "red"},
      {color: "green"},
      {color: "blue"},
      {color: "red"},
      {color: "green"},
      {color: "blue"},
      {color: "red"}
  ];
  
  angular.forEach(a, function(elem, index) {
    if (a.length &gt; colors.length) {
      // .......                       
    }
    elem.color = colors[index];
  });
  </code></pre>
  
  <p>The question: Is there some way to reset the index of foreach to start looping the "colors" array from beginning? Thanks for help</p>