Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

79
Vistas
Angular2 directive implementing ControlValueAccessor on component gives error

I'm trying to create a custom date directive in angular 2 that works with the built in [(ngModel)] directive.
According to the angular2 docs (and various blogs I found), I implemented the ControlValueAccessor interface which works ok if I put my directive on an <input /> element.

<input name="birthday" my-date [(ngModel)]="model.birthday" />

When I put my directive on another component I get the following error:

<other-input name="birthday" [(ngModel)]="model.birthday" my-date></other-input>

More than one custom value accessor matches form control with unspecified name attribute

As it looks like from the code above, I've specified the name attribute already. So I'm stuck with this exception that I could not find anything useful about. Is this some kind of limitation of the ControlValueAccessor interface?

The other-input component is a third party component that I cannot make any change about. Also I would like to use it on many components (also on ionic inputs for example), not just one. Any suggestion or ideas on how to solve this are welcome!

ps: I'm using Angular 2.4.0 with typescript

about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda