I'm struggling to display this this json with embedded hours array on the front end in a simple table (timetable) with days of the week as columns and hours in rows. if the hour exists (in the json), display AVAILABLE with a green color in the table cell. Starts with "Wednesday 18th" to "Tuesday" 24th skipping "Sunday". A day has 9 hours [9,10,11,12,13,14,15,16,17] from 9am to 5pm.
$scope.data = {};
$scope.data.response = "AVAILABLE";
$scope.data.calendar = [
{
"Date": "2016-05-18",
"HoursAvailable": [9, 10, 11, 12, 13, 14, 17]
},
{
"Date": "2016-05-19",
"HoursAvailable": [9, 10, 11, 12, 13, 14, 15, 16, 17]
},
{
"Date": "2016-05-20",
"HoursAvailable": [9, 10, 14, 15, 16, 17]
},
{
"Date": "2016-05-21",
"HoursAvailable": [9, 10, 11, 12, 13]
},
{
"Date": "2016-05-23",
"HoursAvailable": [13, 14, 15, 16]
},
{
"Date": "2016-05-24",
"HoursAvailable": [11, 12, 15, 16, 17]
}
];
HTML
<table class="table">
<thead>
<tr>
<th>time</th>
<th>Wednesday 18th</th>
<th>Thursday 19th</th>
<th>Friday 20th</th>
<th>Saturday 21st</th>
<th>Monday 23rd</th>
<th>Tuesday 24th</th>
</tr>
</thead>
<tbody>
??
</tbody>
</table>