Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

81
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!