I’m struggling with group by for a list. My JSON data is an array of objects, each object is an event with a title, description and start time. I want to group by start time. The JSON below should be displayed in a list, with 1 header showing 1 item, and another header showing 2 items. I’m willing to restructure the JSON if necessary.
The error I get is
TypeError: undefined is not an object (evaluating '_co.item.event_title')
The code:
<ion-list ng-repeat="(key, value) in items | groupBy: 'start_time'">
<div class="item item-divider">
<h1>{{key}}</h1>
</div>
<h3 ng-repeat="item in value">{{item.event_title}}</h3>
<div>
{{item.event_description}}
</div>
</ion-list>
JSON DATA (I’m not having any problem with the provider, I have plenty of lists working
[
{
"event_id": 1,
"event_title": "Test",
"event_description": "This is a test",
"event_date": "2018-03-14",
"start_time": "13:00:00",
"end_time": "14:30:00"
},
{
"event_id": 2,
"event_title": "Test2",
"event_description": "This is a test 2",
"event_date": "2018-03-14",
"start_time": "15:30:00",
"end_time": "17:00:00"
},
{
"event_id": 2,
"event_title": "Test 3",
"event_description": "This is a test 3",
"event_date": "2018-03-14",
"start_time": "15:30:00",
"end_time": "17:00:00"
}
]