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

124
Vistas
Getting undefined nativeElement when using @viewchid with *ngIf condition

Getting undefined nativeElement when using @viewchid with *ngIf condition

Error

Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'nativeElement')

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

@ViewChild('myElement', { static: false }) myElement: ElementRef<HTMLElement>;

Don't call it in the constructor, ngAfterViewInit is the first hook to have it defined.

about 4 years ago · Juan Pablo Isaza Denunciar

0

If your `*ngIf condition is dynamic you should probably use a setter.

  @ViewChild('myElement') set setMyElement(myElement: ElementRef) {

    if (myElement) {
      // Here you can access content.nativeElement etc.
    }

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