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

151
Views
Angular Error: NG0100 when a directive use @Input to access ElementRef in ng-container

Minimal error version reproduction: https://stackblitz.com/edit/angular-zlh4ri

explanation:

  1. a component(comp1) use <ng-container><span #viewEl></span></ng-container>;
  2. another component(comp2) use <span #viewEl></span>;
  3. a commom directive try to access the #viewEl in 1/2 component;
  4. comp1 raize a error: NG0100: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '[object Object]'. Current value: 'undefined'

How should I fix it? (Allow change structure, but note that the directive should keep a copy of viewEl because I need it

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can make the ViewChild in Comp1 static: true to resolve query results before change detection runs.

@ViewChild('viewEl', { read: ElementRef, static: true })

Have a look at the docs for more information.

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