In my Angular application, I am working with an array named calendarDates that holds various date-related information.
calendarDates = [
{"date": "2018-10-23", "day": 5, "month":10, "year":2018, "price":"500", "date_is_valid": true},
{"date": "2018-10-24", "day": 6, "month":10, "year":2018, "price":"550", "date_is_valid": false},
...
{"date": "2018-11-01", "day": 1, "month":11, "year":2018, "price":"600", "date_is_valid": true},
...
{"date": "2019-02-01", "day": 2, "month":12, "year":2019, "price":"700", "date_is_valid": false}
]
I am aiming to render this data in HTML where each month has its own wrapper div:
<div *ngFor='let calendarDate of calendarDates'>
<div class='month'>
<div class='october'>
<p>October</p>
<div class='date'>{{calendarDate.date}} (2018-10-23)</div>
<div class='date'>{{calendarDate.date}} (2018-10-24)</div>
...
</div>
<div class='november'>
<p>November</p>
<div class='date'>{{calendarDate.date}} (2018-11-01)</div>
...
</div>
<div class='february'>
<p>February</p>
<div class='date'>{{calendarDate.date}} (2019-02-01)</div>
...
</div>
</div>
</div>
I am struggling with filtering the data and organizing it by month in the HTML itself. How can I achieve this using ngIf directives while ensuring that changes in values like price or date validity are reflected dynamically?