-2
I am trying to do a validation so that the value of my input type="number" is >= 1. But I have tried several things and none of them worked. I am now trying to use ng-Pattern. But there is a loophole. If I type 0 it invalidates, but if I type 01 it validates!
<div ng-if="validaQtdPromotores(cadastro.cargo)" ng-class="{ 'has-error' : formCadastro.qtdPormotores.$invalid && !formCadastro.qtdPormotores.$pristine }">
<input type="number" name="qtdPormotores" ng-model="cadastro.qtdPormotores" ng-pattern="/[1-9]/" placeholder="Quantos promotores coordena?" required />
<p ng-show="formCadastro.qtdPormotores.$invalid && !formCadastro.qtdPormotores.$pristine">Entre com um número válido.</p>
</div>
01 is greater than or equal to 1, you do not want to accept any character 0?
– Leonardo Xavier
The idea is that the number cannot start with zero. Ex: '0112'. So you can start with any number of 1-9 and have zeros afterwards!
– alan