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

134
Views
Is there a way to access host in a component implementing ControlValueAccessor?

By host, I understand the scope of where my component is used. If it is defined as <my-component>, then if it’s used somewhere as:

<my-component name=“Test” class=“test-class” #test=“ngModel” [(ngModel)]=“data.test” required>

then I would like to:

  • know if host component has a certain css class (i.e. test-class) applied to it.
  • get all the validators that are applied to the ngModel there (i.e. RequiredValidator)
  • know if form that ngModel belongs to has been submitted (without introducing own custom property)

For some reason, I couldn’t get to it reliably. I know of:

  • HostBinding, but that is sadly one way only and can apply classes on host, but is not updated with regards to what classes already are there
  • ElementRef injection, where I can get to nativeElement and props. That gives me classes (but very low level), but not validators / ngModel.

Is the access to ngModel “above” on the host element not allowed here?

about 4 years ago · Juan Pablo Isaza
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!