I have a ngFor loop like so: <div *ngFor="let group of catt" id="juliet" [ngClass]="hf()">
where I call the hf() function each time which looks like so:
hf() {
this.heighty = document.getElementById('juliet').offsetHeight;
console.log("juliet function height = " + this.heighty);
}
But the for loop goes through 4 times for the data, but only gives the height of the first loop, and then gives that same height for each loop their after. When I inspect the elements I see the 4 loops with different heights. I also do not see an identifier for each loop, like juliet[0]
. How do I get the heights for each loop of the for loop?