ngx-mask
ngx-mask copied to clipboard
NgxMask doesn't work with matAutocomplete
I'm trying to use NgxMask along with matAutocomplete. They don't work together. I get an error:
Error: More than one custom value accessor matches form control with unspecified name attribute
Please, make them compatible or add your own autocomplete feature to NgxMask.
Thank you in advance!
I confirm that doesn't work, same error:
<div [formGroup]="formGroup">
<mat-form-field style="width: 100%; margin-top: 5px">
<input matInput
[matDatepicker]="picker"
autocomplete="off"
placeholder="gg/mm/aaaa"
formControlName="dateControl"
mask="d0/M0/0000"
[leadZeroDateTime]="true"
(ngModelChange)="onDateChanged($event)"
style="width: 100%">
<mat-datepicker-toggle matSuffix [for]="picker" tabindex="-1">
<mat-icon matDatepickerToggleIcon>expand_more</mat-icon>
</mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
</div>
Hello everyone. I also face that issue with matAutocomplete, any thoughts on this? @NepipenkoIgor @anmal
Hello everyone. I also face that issue with matAutocomplete, any thoughts on this? @NepipenkoIgor @anmal
As I understood, the only way is to extend ngx-mask functionality with its own autocomplete implementation, but you can't use matAutocomplete along with ngx-mask because they both are custom form controls with their own ValueAccessor. But angular allows you to use only one ValueAccessor. You can either implement your own autocomplete for ngx-mask form controls, or your own mask for matAutocomplete form controls (that was our way).
Hello everyone. I also face that issue with matAutocomplete, any thoughts on this? @NepipenkoIgor @anmal
As I understood, the only way is to extend ngx-mask functionality with its own autocomplete implementation, but you can't use matAutocomplete along with ngx-mask because they both are custom form controls with their own ValueAccessor. But angular allows you to use only one ValueAccessor. You can either implement your own autocomplete for ngx-mask form controls, or your own mask for matAutocomplete form controls (that was our way).
I had the same problem: I needed to mask a MatAutocomplete.
Similar to what anmal did we "hacked" a vanilla-text-mask to the MatAutocomplete input. Our only problem with vanilla-text-mask was that it has no type definitions.
Hello. I have this problem with matAutocomplete too. Do you have any news? Or any idea where the root cause is coming from? From ngx-mask or from Angular Material?