GroupBy日期和时间,orderBy日期和时间AngularJS

时间:2015-12-04 09:23:14

标签: angularjs

我想在这里实现这个观点。从我拥有的东西开始,直到第二天发生事件,然后时间顺序不起作用,以及第二天的事件在之前发生的事件之后显示。我使用angular.filter对结果进行分组 enter image description here

myController的

    $scope.histories = response.revision_history.map(function (data) {
        return {
            "date": data.created_at.substring(0,10),
            "time": data.created_at.substring(11,19),
            "user": data.user_id,
            "property": data.key,
            "old": data.old_value,
            "new": data.new_value
        }
    });

                                            .col-md-12(ng-repeat="history in histories | groupBy: 'date' | toArray: true")
                                                .crm-history-seperator
                                                    span {{ history[0].date }}
                                                .repeater(ng-repeat="event in history | groupBy: 'time' | toArray: true")
                                                    span.time {{ event[0].time }}
                                                    .repeater(ng-repeat="ev in event")
                                                        .content
                                                            .activity
                                                                span.user {{ ev.user }}
                                                                span.explanation Changed {{ ev.property }}
                                                                span.explanation(ng-if="ev.old !== null") from
                                                                span.event(ng-if="ev.old !== null") {{ ev.old }}
                                                                span.explanation to
                                                                span.event {{ ev.new }}

如果某些事件在第二天发生,我就会得到这些

enter image description here

这是我想要实现的目标

enter image description here

1 个答案:

答案 0 :(得分:0)

根据我的结论,在您的情况下,排序不起作用。我认为你的答案介于Traceback (most recent call last): File "C:/Users/~compname~/Desktop/Game.py", line 5, in <module> print('{0:>{width}}''{6:<{width2}}'.format(myCharacter, width = myWidth, width2 = mywidth2)) IndexError: tuple index out of range groupBy预期参数的方式之间。看看下面的答案。

https://github.com/a8m/angular-filter/issues/57#issuecomment-65041792