gpt4 book ai didi

angularjs - 如何按月份名称排序

转载 作者:行者123 更新时间:2023-12-02 09:30:16 25 4
gpt4 key购买 nike

我试图弄清楚如何按月份名称对数据进行排序,但我似乎所能做的就是按字母顺序对其进行排序。我该如何去做呢?

这是我的骗子的链接:http://plnkr.co/edit/sS9dSQ5IknQEsy0L4y1h?p=preview

和 HTML:

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<script data-require="<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3a5b545d4f565b481450497a0b1409140b0a" rel="noreferrer noopener nofollow">[email protected]</a>" data-semver="1.3.10" src="https://code.angularjs.org/1.3.10/angular.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>

<body ng-app="myApp">
<div ng-controller="myCtrl">
<div ng-repeat="month in months | orderBy: 'english' | date:'MMMM'">
<p><strong>{{ month.english | date:"MMMM" }}</strong></p>
</div>
</div>
</body>
</html>

最佳答案

您应该通过ordinal订购而不是english 。即:

<div ng-repeat="month in months | orderBy: 'ordinal' | date:'MMMM'">

关于angularjs - 如何按月份名称排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33864140/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com