Consider this input control:
<input ng-model="vm.loanAmount" ng-min="1" type="text" name="LoanAmount" id="LoanAmount" required>
Consider this validation:
<ng-messages for="myForm.$dirty && myForm.LoanAmount.$error" multiple>
<ng-message when="required">
<p>An amount is required.</p>
</ng-message>
<ng-message when="number">
<p>The amount must be a valid number.</p>
</ng-message>
<ng-message when="min">
<p>The amount must be greater than 0.</p>
</ng-message>
</ng-messages>
I need this field as a text type field, but want to use ng-messages
module to validate it to take numbers only. How is this possible without changing the field type to number?
At the moment, the only message that successfully fires is the required
parameter. I'd like to allow numbers only, over the value of 0.
Thanks.