Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

116
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda