title: AngularJS validate form array length
body: <p>Say I have a model object with the attribute <code>favoriteColors</code></p>
  
  <pre><code>{
      ...
      favoriteColors: ['red', 'green', 'blue']
      ....
  }
  </code></pre>
  
  <p>I expose them to the user with an ng-repeat</p>
  
  <pre><code>&lt;form name="userForm"&gt;
      ...
      &lt;ul&gt;
          &lt;li ng-repeat="color in user.favoriteColors"&gt;
              &lt;input type="text" ng-model="color" /&gt;
              &lt;a href="" ng-click="delete(color)"&gt;remove&lt;/a&gt;
          &lt;/li&gt;
      &lt;/ul&gt;
      &lt;a href="" ng-click="add()"&gt;Add a new favorite color&lt;/a&gt;
      ...
  &lt;/form&gt;
  </code></pre>
  
  <p>I would like to be able to check the validity of the <code>favoriteColors</code> field doing something like this</p>
  
  <pre><code>&lt;div ng-show="userForm.favoriteColors.$error"&gt;
      You must have at least one favorite color
  &lt;/div&gt;
  </code></pre>
  
  <p>It doesn't seem possible to do this using a built in validator, and I'm not sure on which element I would put a custom directive in order to get the <code>ngModelController</code> for <code>favoriteColors</code>.  </p>