title: Angularjs Validate form on field change using external variable
body: <p>I'm writing a <code>form</code> where a user can add multiple credit card information, similar to this one:</p>
  
  <pre><code>&lt;form name="newCard"&gt;
      &lt;label for="surname"&gt;Card number: &lt;/label&gt; 
      &lt;input type="text" ng-model="formCard.code" required name="code" /&gt;
  
      &lt;label for="surname"&gt;CVV: &lt;/label&gt; 
      &lt;input type="text" ng-model="formCard.cvv" required name="cvv" /&gt;
  
      &lt;input type="button" value="Add Card" /&gt;
      &lt;input type="button" value="Save" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The "Add card" <code>button</code> adds the validated current card data to a <code>js</code> array in my controller.</p>
  
  <p>I would like the "Save" <code>button</code> to be disabled unless this array is populated. How can I use custom validation in Angular to achieve this?</p>