Angularjs Zulu时间的OrderBy筛选器未按预期工作
我试图在下面的Angularjs Zulu时间的OrderBy筛选器未按预期工作,angularjs,Angularjs,我试图在下面的HTML中将时间latest过滤为null。时间格式为祖鲁(UTC)格式,即'2017/04/01T00:00:00.000Z' <li ng-repeat="contact in $ctrl.contacts | orderBy: 'LastChatTime' | filter : searchContact track by $index"> 而不是: 1. '2017/04/01T00:00:00.000Z' 2. '2017/03/31T13:00:00
HTML
中将时间latest
过滤为null
。时间格式为祖鲁(UTC)格式,即'2017/04/01T00:00:00.000Z'
<li ng-repeat="contact in $ctrl.contacts | orderBy: 'LastChatTime' | filter : searchContact track by $index">
而不是:
1. '2017/04/01T00:00:00.000Z'
2. '2017/03/31T13:00:00.000Z'
3. `Null`
如果您注意到您的记录是按升序排列的,这是
orderBy
的行为
在这里,您需要按降序排列您的联系人
你可以试试下面的代码
<li ng-repeat="contact in $ctrl.contacts | orderBy: '-LastChatTime' | filter : searchContact track by $index">
<li ng-repeat="contact in $ctrl.contacts | orderBy: '-LastChatTime' | filter : searchContact track by $index">
<li ng-repeat="contact in $ctrl.contacts | orderBy: '[!LastChatTime, -LastChatTime]' | filter : searchContact track by $index">