I have a div element that is looped through an array of objects using *ngFor. The height of a particular div is different from each other as each object contains different amoun
You can use ViewChildren to get the elements, and in ngAfterViewInit, get the size
<div class="col-md-4" *ngFor="let food of foods">
<div #foodcard class="food-card">
<h4>{{food.title}}</h4>
<p>{{food.ingredients}}</p>
</div>
</div>
@ViewChildren('foodcard') foodCards:QueryList<ElementRef>
ngAfterViewInit()
{
let maxHeight=0
this.foodCards.forEach(x=>{
const height=x.nativeElement.getBoundingClientRect().height
if (heigth>maxHeight)
maxHeight=height
})
}
Anyway, if your aim is set the same height check card-deck