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