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

114
Views
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
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!