I have a component with a flex box of child components. I'm trying to get information like the element width of each component from with in my parent component. What I'm trying to do in the end is know if the list is overflowed so I can modify the number of visible elements. If it is overflowed, I'd like to put a special element at the end that shows the number of icons that are currently hidden.
I've tried using the @ViewChildren but can't figure out how to get the element dimensions from this. How can I go about doing this?
<div class="file-list">
<app-file-icon [text]="file" *ngFor="let file of files"></app-file-icon>
</div>
css:
.file-list {
width: 200px;
height: 120px;
border: 1px solid grey;
padding: 10px;
margin: 10px;
display: flex;
flex-direction: row;
flex-wrap: wrap;
/* overflow: hidden; */
}
sandbox: