title: Why does the ng-repeat directive create a child scope?
body: <p><strong>Question:</strong> Why does the ng-repeat directive create a child scope?</p>
  
  <p>I don't understand why this is the case.  Creating a new scope makes sense to an extent if you  explicitly create a child controller, but why would it automatically create one for every ng-repeat?</p>
  
  <p>I guess the reason it confuses me is because if you create a loop in JS, that doesn't mean the  code outside the loop can't access any of the variables inside of it.</p>
  
  <p>Example:</p>
  
  <pre><code>for(var x=0; x&lt;10; x++) {
     var y = x
  }
  alert(y);
  </code></pre>