a8m / angular-filter

Bunch of useful filters for AngularJS (with no external dependencies!)
https://github.com/a8m/angular-filter
MIT License
2.93k stars 331 forks source link

groupBy : 'datetime' #218

Open henriquealho opened 8 years ago

henriquealho commented 8 years ago

Hi, I'm trying to groupBy a datetime but what happens is that all my datetime's are different and I get different groups by each minute.

How can I change the datetime when doing the ng-repeat ?

My code:


<ul class="timeline" ng-repeat="(key, value) in notifications | groupBy: 'datetime'">

    <!-- timeline time label -->
    <li class="time-label">
      <span class="bg-blue">
        {{key | date: 'MMM d, y'}}
      </span>
    </li>
    <!-- /.timeline-label -->

    <!-- timeline item -->
    <li ng-repeat="notification in value">
      <!-- timeline icon -->
      <i class="ng-class: notification.cssClass ;"></i>
      <div class="timeline-item">
        <span class="time"><i class="fa fa-clock-o"></i> {{notification.datetime | date : 'HH:mm'}}</span>

        <h3 class="timeline-header">
          <a ng-href="{{notification.url}}">{{notification.title}}</a>
        </h3>

        <div class="timeline-body">
          <p ng-bind-html="notification.message"></p>
        </div>
      </div>
    </li>
    <!-- END timeline item -->

  </ul>

Thank you!