When using type='text'
for input, the ng-pattern
validation works while the ng-max
validation does not.
In contrast, when using type='number'
, the ng-pattern
validation fails to work while the ng-max
validation functions properly. This results in allowing an unlimited amount of zeroes at the beginning and end of the input.
For example:
<input name="input" type="number" placeholder="0.00"
data-ng-model="example.value"
data-ng-max="100"
data-ng-pattern="/^0(\.\d{1,2})?$|^[1-9]\d{0,14}(\.\d{1,2})?$/"
data-ng-required="true"/>
http://plnkr.co/edit/hv3qrTZzBy8RlPGT8Snv?p=preview
How can this issue be resolved?