title: angularjs: forEach in ng-click
body: <p>I have a problem with implementing "select All" feature for simple list:</p>
  
  <p>Controller:</p>
  
  <pre><code>$scope.numbers = [{v:1},{v:2},{v:3},{v:4}];
  </code></pre>
  
  <p>Template:</p>
  
  <pre><code>&lt;a href="" ng-click="numbers.forEach(function(v) {v.selected=true;});"&gt;select All&lt;/a&gt;
  &lt;p ng-repeat='n in numbers'&gt;
    &lt;label&gt;
      &lt;input type="checkbox" ng-model="n.selected"&gt;
      Label: {{ n.v }}
    &lt;/label&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>It seems angular parser cannot process the ng-click statement:</p>
  
  <blockquote>
    <p>Error: [$parse:syntax]<br>
    (...) <br>
    at relational (angular.min.js:234) <br>
       at r.equality (angular.min.js:233) <br>
       at r.logicalAND (angular.min.js:233) "&lt;a href="" ng-click="numbers.forEach(function(v) {v.selected=true;});">"</p>
  </blockquote>
  
  <p>Plunker demo:
  <a href="https://plnkr.co/edit/6OZP02SZ5ZYa0iO4PBY3?p=preview" rel="nofollow noreferrer">https://plnkr.co/edit/6OZP02SZ5ZYa0iO4PBY3?p=preview</a></p>
  
  <p>Can I implement that just in the html template or have to use the controller method?</p>
  
  <p><strong>Edit</strong>: Controller method works fine, I'm just still interested why in-place code doesn't parse though?</p>