I have a component named Grid, its template is:
<div *ngFor="let row of item.rows">
<div *ngFor="let col of row.cols">
<div *ngFor="let grid of col.items">
<app-grid [item]="grid"></app-grid>
<!-- another content -->
</div>
</div>
</div>
and a parent component with the content:
<div *ngFor="let entireGrid of ser.Grids">
<app-grid [item]="ser.entireGrid"></app-grid>
</div>
In my parent component ts I have this constructor:
constructor(public ser:myService){
ser.getGrids().subscribe(data=>{
data.grids.foreach(g=>{
ser.grids.push(g);
});
});
and myService has the variable:
grids:Array<Grid>=[];
my problem is - each entireGrid is nested very deeply (inside it there are many rows and inside them many cols and inside them many grids and inside them many rows again...)
so when I reshow the parent component the deepest grids don't appear, only when I click on one of the grids that does appear they appear.
I've tried to put cd.detectChanges
in the grid component in the functions ngOnInit
, ngAfterViewChecked
, ngDoCheck
but nothing worked.
does somone have an idea how to solve it?