I am looking to create a list that is grouped by date, similar to the image below. However, I am unsure how to implement this feature.
https://i.sstatic.net/7vjz0.png
You can see my code example and demo on Stackblitz
app.component.html
<div *ngFor="let monthData of products">
<div class="upcoming-container">
<div class="upcoming-container-title-section color">
Group Month | {{monthData.date | date : 'MMMM yyyy' }}
</div>
<div class="upcoming-container-card-section">
<div *ngFor="let card of products" class="col-xl-2 col-lg-3 col-md-4 col-sm-6 col-6 upcoming-container-card-item">
<app-card [listData]="listData"></app-card>
</div>
</div>
</div>
</div>
card.component.ts
_listData: listData;
@Input()
set listData(data: listData) {
this._listData = data;
}
get listData() {
return this._listData;
}
constructor() { }
}
card.component.html
<div class="cards-list">
<div class="card 1">
<div class="card_image"> <img src="https://i.redd.it/b3esnz5ra34y.jpg" /> </div>
<div class="card_title title-white">
<p>{{listData.date | date: 'd MMM yyyy'}}</p>
</div>
</div>
</div>