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

82
Views
Detectar montaje de componente web en DOM

Leí este hilo creado componente web:

 <my-vue-web-comp [userId]="1" id="my-component"></my-vue-web-comp>

Funciona bien en Angular. ¿Cómo puedo detectar cuándo se montó el componente web en DOM?

En este código obtengo nulo:

 ngAfterViewInit() { const myComponent = document.getElementById('my-component') console.log(myComponent) //null }

En este código obtengo mi componente, pero debo esperar 0.5 segundos:

 ngAfterViewInit() { setTimeout( function() { const myComponent = document.getElementById('my-component') console.log(myComponent) //not null }, 500) }

¿Existe alguna herramienta (evento) para detectar el montaje de componentes web en DOM?

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

0

Necesita agregar connectedCallback() de los documentos :

 Vue.customElement('web-component', (MyWebComponent as any).options, { connectedCallback() { console.info('connectedCallback', this) }})
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!