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

310
Views
¿Cómo resolver un problema de inicialización de mecanografiado en mi proyecto Angular?

Tengo un proyecto Angular y estoy tratando de definir una variable con el siguiente tipo:

 navbarLinks: QueryList<ElementRef>;

pero me sale el siguiente error:

 Property 'navbarLinks' has no initializer and is not definitely assigned in the constructor. 30 navbarLinks: QueryList<ElementRef>;

Ahora, no quiero usar esto como una solución:

 navbarLinks!: QueryList<ElementRef>;

¿Hay alguna otra manera de arreglar esto?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Si realmente no desea establecer un valor predeterminado para esta propiedad, debe ajustar su tipo a

 navbarLinks?: QueryList<ElementRef>;

que es lo mismo que

 navbarLinks: QueryList<ElementRef> | undefined;

Otra solución sería darle a la propiedad un valor predeterminado. Como no sé cómo es la QueryList<T> , no puedo darte un ejemplo.

over 4 years ago · Santiago Trujillo 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!