Angular orderBy Date

前端 未结 2 476
孤独总比滥情好
孤独总比滥情好 2020-12-06 23:03

I have an array which I want to order by date in Angular.js:


    {{er.pu         


        
2条回答
  •  攒了一身酷
    2020-12-06 23:42

    To make to orderBy to work you need wrap string date with object of new Date(/**/) in controller.

    For example:

    $scope.vm.readerFeeds = [
     {
      //.....
      publishedDate: new Date(/*your string date*/);
      },
     {
       //.....
      publishedDate: new Date(/*your string date*/);
     }
    ];
    

提交回复
热议问题