I have an array with hour values which I present in a select tag as follows:
Select
07:00:00
07:10:00
07:20:00
07:30:00
07:40:00
07:50:00
08:00:00
But I want to know how to group them as follows:
07:00:00 - 07:10:00
07:10:00 - 07:20:00
07:20:00 - 07:30:00
07:30:00 - 07:40:00
07:40:00 - 07:50:00
07:50:00 - 08:00:00
This is what I have so far:
HTML
<div ng-controller="MyCtrl">
<select ng-model="data.rh"
ng-init="data.rh=rangoHoras[0].h"
ng-options="rh.h as rh.h for rh in rangoHoras"
style="color:#283593;">
</select>
</div>
controller.js
function MyCtrl($scope) {
$scope.rangoHoras=[
{"h":"07:00:00"},{"h":"07:10:00"},{"h":"07:20:00"},
{"h":"07:30:00"},{"h":"07:40:00"},{"h":"07:50:00"},
{"h":"08:00:00"}
];
}
You can make a method that serves as a filter to return the schedules the way you want.
And the select is as follows
Example:
http://codepen.io/DKbyo/pen/GqYwQb