0

I have a simple repeater setup:

<div ng-controller="EventController">
    <div class="input-group" id="search">
        <label>Search:</label><input type="text" id="searchField" class="form-control" ng-model="search" />
    </div>
    <div class="row tableCell" ng-repeat="event in events | filter:search">
        <a href="/EventDetails/{{ event.ID }}"><h1>{{ event.Name }}</h1></a>
        <p>{{ event.Description }}</p>
        <ul>
            <li>Time Begin: {{ event.TimeBegin }}</li>
            <li>Duration: {{ event.Duration }}</li>
        </ul>
    </div>
</div>

<script type="text/javascript">
    function EventController($scope, $http) {
        $http({
            method: 'GET',
            url: '//localhost:60009/api/event'
        })
        .success(function (data) {
            $scope.events = data;
        })
        .error(function (data) {
        });
    }
</script>

These events has a property: DateBegin that I would like to group them by. e.g. given the following data:

ID      DateBegin
-------------------------------
1925    2014-12-04 00:00:00.000
1664    2014-12-05 00:00:00.000
1412    2014-12-06 00:00:00.000
1976    2014-12-06 00:00:00.000
1413    2014-12-09 00:00:00.000

I'd like to do something like:

(Note: I'll stick this in HTML using a modified version of my provided code, this is just for illustrative purposes)

  • 12/4/2014
    • Event 1925
  • 12/5/2014
    • Event 1664
  • 12/6/2014
    • Event 1412
    • Event 1976
  • 12/9/2014
    • Event 1413

Is this possible?

drewwyatt
  • 5,989
  • 15
  • 60
  • 106
  • 2
    Have you tried [how-can-i-group-data-with-an-angular-filter](http://stackoverflow.com/questions/14800862/how-can-i-group-data-with-an-angular-filter) – Ben Felda May 16 '14 at 14:54
  • @BenFelda No! and this looks exactly like what I am looking for. Trying it now. Thanks! – drewwyatt May 16 '14 at 14:58

0 Answers0