My goal is to present data from a JSON array in a table using the code below. However, all the data is currently being shown in one row instead of each record appearing on separate rows with alternating colors - grey for even rows and white for odd rows. I suspect there is an error in my implementation but I can't seem to pinpoint it.
CSS Style:
table,td {
border: none;
border-collapse: collapse;
padding: 5px;
width:1047px;
height: 64px;
left:16px;
position:relative;
}
table tr:nth-child(odd) {
background-color: #f1f1f1;
}
table tr:nth-child(even) {
background-color: #ffffff;
}
My View (This snippet is displayed within index.html):
<h1 id="title">Shuttle Schedule</h1>
<table width="100%" cellpadding="4" cellspacing="25" style="margin-top:-118px">
<thead align="center">
<th ng-repeat="row in module.csvInput">{{row.label}}</th>
<th ng-repeat="row in module.csvInput">{{row.label}}</th>
</thead>
<tr align="center" >
<td ng-repeat="row in module.csvInput" >
<div ng-repeat="(id, time) in row.times" ng-if="id <= 8">
{{time}}
</div>
</td>
<td ng-repeat="row in module.csvInput">
<div ng-repeat="(id, time) in row.times" ng-if="id > 8">
{{time}}
</div>
</td>
</tr>
</table>
<h3 class="noservice">No Service 1:20pm to 2:00pm<br> Driver can make additional runs beyond this schedule if needed.<br>
D1 is 8910 Ridgeline Blvd. D4 is 8744 Lucent Blvd.</h3>
</div>
Snippet of My JSON Data:
{
"modules": [
{
"title": "Shuttle Schedule",
"feature": "shuttle",
"order": 4,
"csvInput": [
{
"label": "D1 PickUp",
"times": [
"8:00 AM",
"8:30 AM",
"9:00 AM",
"9:30 AM",
"10:00 AM",
"10:30 AM",
"11:00 AM",
"11:30 AM",
"12:00 PM",
"12:30 PM",
"1:30 PM"
]
},
{
"label": "D4 PickUp",
"times": [
"7:50 AM",
"8:20 AM",
"8:50 AM",
"9:20 AM",
"9:50 AM",
"10:20 AM",
"10:50 AM",
"11:20 AM",
"11:50 AM",
"12:20 PM",
"12:50 PM",
"1:10 PM"
]
}
],
"filter": null,
"icon": "media/shuttle.svg"
}
],
"settings": {
"buildings": 2,
"floor": 4,
"timeout": "120 (in seconds)",
"cssOverride": "custom.css",
"kiosk_coords": "200,200"
}
}
Current Output: https://i.stack.imgur.com/7YZt1.jpg
Desired Presentation Style: https://i.stack.imgur.com/OcxCS.jpg