Use more than one CustomValueAcessor in one Input field
See original GitHub issueIβm submitting a β¦ (check one with βxβ)
[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior I have created 2 directives with a CustomValueAcessor, and when I use them in an field I got the following error:
Error: Uncaught (in promise): Error: More than one custom value accessor matches form control with unspecified name attribute
Expected behavior The input field should accept more than 2 CustomValueAcessor
Minimal reproduction of the problem with instructions
http://plnkr.co/edit/zPz40DNYmAO7mokJ09a9?p=preview
Please tell us about your environment:
βdependenciesβ: { β@angular/animationsβ: β^4.1.0β, β@angular/cliβ: β^1.0.0-beta.28.3β, β@angular/commonβ: β^4.1.0β, β@angular/compilerβ: β^4.1.0β, β@angular/compiler-cliβ: β^4.1.0β, β@angular/coreβ: β^4.1.0β, β@angular/formsβ: β^4.1.0β, β@angular/httpβ: β^4.1.0β, β@angular/platform-browserβ: β^4.1.0β, β@angular/platform-browser-dynamicβ: β^4.1.0β, β@angular/platform-serverβ: β^4.1.0β, β@angular/routerβ: β^4.1.0β }
- Angular version: 2.0.X
- Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
-
Language: [all | TypeScript X.X | ES6/7 | ES5]
-
Node (for AoT issues):
node --version
=
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:16 (3 by maintainers)
As mentioned above, text-mask wonβt work with material2. A workaround is to use the vanilla version of text-mask: 1 - Import the library in your component
import * as textMask from "vanilla-text-mask/dist/vanillaTextMask.js";
2 - Add your mask in the component and init your input (donβt forget to import AfterViewInit and implement it to your component)
3 - in your template, make sure the input element has an #input attribute
i have a solution with a directive using the solution of @remborg
<input matInput formControlName="FechaInicio" [matDatepicker]="FechaInicioRef" placeholder="Fecha Inicio" appMaskDate>