I am using *ngFor
to create a bunch of div
s. I would like to get my hands on one of them and get its width.
.html
<div #elReference *ngFor="let el of elements> HEHE </div>
.ts
@ViewChild("elReference") elReference: ElementRef;
Apparently, you cannot use ViewChild
with *ngFor
, because elReference
remains undefined
.
How do you get element reference created with *ngFor
?