ngFor + a static element creates a gap in the grid
See original GitHub issueFirst, thank you for this amazing lib! I’m having an issue with the following code snippet:
<ngx-masonry [options]="{ gutter: 15 }">
<div ngxMasonryItem class="document masonry-item" *ngFor="let number of [0,1,2,3,4]">
<div class="content">
<div class="icon">
<div class="triangle-topright"></div>
<mat-icon>mic</mat-icon>
</div>
</div>
<div class="label">Record {{number}}</div>
</div>
<div ngxMasonryItem class="document new masonry-item" (click)="recordReport">
<div class="content">
<div class="icon">
<div class="triangle-topright"></div>
<mat-icon>add</mat-icon>
</div>
</div>
<div class="label">Upload a record</div>
</div>
</ngx-masonry>
the combination of ngFor and a static element seems to create a gap in the grid:
this is not the case without the static element:
Is it possible to use ngx-masonry this way? Otherwise, do you know a workaround?
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
html - How to order the content generated by *NgFor in rows ...
I am trying to get the elements generated by *NgFor to be sorted into 3 elements per row. Currently this code puts all...
Read more >[Solved]-Using Angular *ngFor in a CSS-Grid-Layout?
You can use row-gap, column-gap or gap instead. Regarding grid distribution, have you tried grid-template-rows or grid-template-columns: auto ?
Read more >Padding problem at last element in every row when using ...
I'm currently facing a big issue in the library. The problem is the fxLayoutGap setting for grid likely designs but just as a...
Read more >Angular Flex-Layout: Flexbox and Grid Layout ... - InDepth.Dev
In Angular, it is common for a view of a component to be divided into template HTML and stylesheet CSS. Since the layout...
Read more >NgForOf - Angular
NgForOf uses the computed key to associate items in an iterable with DOM elements it produces for these items. A custom TrackByFunction is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks! The ngIf solution works perfectly
Le ven. 10 juil. 2020 à 21:52, wynfred notifications@github.com a écrit :
For me it appears that static elements are added immediately to the list of items, but then after that they are spotted as new items, which means that every static element will add a new empty gap. In my case I have 5 static elements, which means that the total count of items in the masonry is 10.