Open peresbruno opened 7 years ago
Same problem here with a birthDate field.
@firestar300 some workaround?
Yes I changed my Regex expression to allow my birthdate value with this format : DD/MM/YYYY and this format : DDMMYYYY and it works as expected.
Hello,
I have an input with this definition:
<input name="{{config.id}}" type="tel" ui-mask="{{mask}}" ng-pattern="pattern" ui-mask-placeholder-char="space" ng-model="ngModel" ng-required="config.required" model-view-value="true" ng-blur="blur();" ng-change="change();" ng-model-options="{ allowInvalid : true }" ui-options="{ allowInvalidValue : true, addDefaultPlaceholder : false }" >
This input need accepts values like (99)9999-9999 and (99)99999-9999.
Inside
change()
function themask
andpattern
variables are changed according the quantity of digits in ngModel. This works fine. My problem is that the validation is fired before the mask is applied to input value. For this reason my input is considered invalid. For example:Step 1 (Input is valid)
Step 2 (I type a 5, pattern and mask values are changed. Validations are fired and the input is considered invalid because the mask is not applied.)
Step 3 (The new mask is applied. However, the input remains invalid because validations are not fired again.)
Is there a way to identify when the mask is applied to input? Is there another way (best, maybe) to achieve this goal?
Thanks! :)