ngx-mask: Error: More than one custom value accessor matches form control with unspecified name attribute
Hey,
I 'm using the Angular 5.0 and Angular Material 2.0.0-beta.8, when i applied the ngx-mask within my custom component i got the below error
<md-input-container class="full-width">
<input mdInput [mdDatepicker]="datepicker" placeholder="Date" mask="00/00/0000" dropSpecialCharacters="false" [placeholder]="label"
[required]="required" [formControl]="formControl" />
<md-datepicker #datepicker></md-datepicker>
<span class="fa fa-calendar" mdPrefix> </span>
<md-error *ngIf="error">{{ error }}</md-error>
</md-input-container>
ng:///FormComponentsModule/DateComponent.ngfactory.js:36 ERROR Error: More than one custom value accessor matches form control with unspecified name attribute at _throwError (webpack-internal:///…/…/…/forms/esm5/forms.js:2463) at eval (webpack-internal:///…/…/…/forms/esm5/forms.js:2544) at Array.forEach (<anonymous>) at selectValueAccessor (webpack-internal:///…/…/…/forms/esm5/forms.js:2533) at new FormControlDirective (webpack-internal:///…/…/…/forms/esm5/forms.js:6463) at createClass (webpack-internal:///…/…/…/core/esm5/core.js:12363) at createDirectiveInstance (webpack-internal:///…/…/…/core/esm5/core.js:12206) at createViewNodes (webpack-internal:///…/…/…/core/esm5/core.js:13644) at callViewAction (webpack-internal:///…/…/…/core/esm5/core.js:14076) at execComponentViewsAction (webpack-internal:///…/…/…/core/esm5/core.js:13985)
It seems that the formControl attribut is causing the issue when removing it any clue to resolve the issue
Thanks and regards
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 4
- Comments: 17
Please be respectful, this is open source work you don’t have to use.
@dgouissem We used ValueAccessor in our current realization, but angular have limitation -> we can use only one realization ValueAccessor. That why ngx-mask don’t work with material.
if it was to not work, why did you guys build it!!!wtf
still not fix here?
Still the recommended option is not to use this library ?
[UPDATE] I don’t know where previous link was redirecting but correct link is here https://github.com/ng-bootstrap/ng-bootstrap/issues/2291#issuecomment-469926906
Basically use Racoon mask instead of ngx-mask
Could you please add this as a big disclaimer in the documentation?
There is no simple solution
There is a workaround solution not using ngx-mask library Take a look in this issue: https://github.com/angular/angular/issues/16755