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

117
Vistas
How can child check if all HTML elements loaded in Angular

I need to update some HTML elements (element.setAttribute('tabindex', "0")) after the page was loaded (seems that elements are not exists yet during ngOnInit method).

The elements that I am trying to update are related only to specific directive (child) and not to parents' html. Note that this directive is a child of child of child.... Means, the entire HTML is much bigger but the relevant elements that I want to change exist only in the child html.

I am trying to do that using 'AfterContentInit' but I get an error which I am not completely understand how to solve.

The code is something like:

import {Component, Inject, Input, Output, OnInit, EventEmitter, AfterContentInit, AfterViewInit} from 'ng-metadata/core';
.
.
.
export class PrmAdvancedSearch implements OnInit,AfterContentInit,AfterViewInit {
.
.
.
  ngAfterContentInit() {
    console.log("----------------------------------ngAfterContentInit method");
  }

And getting the following error in console log:

Hooks Impl for MyCode:
===================================
You cannot implement AfterContentInit lifecycle, without allowed transclusion.
turn transclusion on within decorator like this: @Component({legacy:{transclude:true}})

If I'll change AfterContentInit to AfterViewInitit will work without the error but seems that the html element still won't be loaded at this point.

I will appreciate any advise here.

Thanks, Mike

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