Angularjs Events group by month Filter

时间:2017-08-30 20:10:12

标签: angularjs

I want to achieve something like this : enter image description here

This is what I have so far: enter image description here

You can see in my case the month is repeating. I want to have the months Group by.

Here is my controller code for var enableDays = new Array(); jQuery.each(json.available_dates, function (i, v) { enableDays.push(v); }); :

2017-08-31,2017-09-01

1 个答案:

答案 0 :(得分:0)

直播 https://plnkr.co/edit/jUhSXJJEAqKnJz1H3kiv?p=preview
HTML:

    

x

使用Javascript:

  <head>
    <meta charset="utf-8" />
    <title>AngularJS Plunker</title>
    <script>document.write('<base href="' + document.location + '" />');</script>
    <link rel="stylesheet" href="style.css" />
        <script data-require="angular.js@1.5.x" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.11/angular.min.js" data-semver="1.5.11"></script>
   <script src="https://cdn.jsdelivr.net/lodash/4.17.4/lodash.min.js"></script>
<script src="app.js"></script>
  </head>

  <body ng-controller="MainCtrl">
    <ul ng-repeat="(key,x) in groupevent">
      {{key|date:'MMMM yyyy'}}
      <li ng-repeat="y in x |orderBy:'start_date'">
        <span>{{y|json}}</span>
      </li>
    </ul>
  </body>

</html>