ngx-mask
ngx-mask copied to clipboard
Maskable FormControl is causing `Validators.required` to not function properly
When applying mask on a formControl, the Validators.required validator reports null where it should have returned {required: true} when the control is empty.
I guess the Validators.required prohibits undefined but not null values? Can it be the case where mask is returning null where it should've returned undefined?
- Control definition:
<input
[prefix]="phoneNumberPrefix + '-'"
autocomplete="phone_number"
class="form-control no-spinner"
formControlName="phone_number"
id="phone_number"
mask="000-000-0000"
name="phone_number"
placeholder="{{'FORM_PLACEHOLDERS.USR_CONTACT_NUM' | translate}}"
type="tel">
ngx-maskversion -7.7.0
FYI, I tried without [prefix] but no luck there.
@bbbneo333 Mask validation only works if at least 1 symbol is entered in the input, otherwise the angular's validation will work (if you have connected it)