gpt4 book ai didi

angularjs - ng-repeat 中 angularjs 中的 orderBy

转载 作者:行者123 更新时间:2023-12-02 04:41:19 25 4
gpt4 key购买 nike

我不明白为什么它不起作用你知道为什么 orderBy'-nbtickets' 不起作用吗?

  <ul ng-repeat="item in customarray | orderBy:'-nbtickets' track by $index">
<li ui-sref="app.usersingle({id:item[0].id,iterate:1})" class="row organization">
<div class="col-md-2 classement text-center">{{$index+1}}</div>
<div class="name col-md-4 text-center">{{item[0].username}}</div>
<div class="col-md-2 total text-center">{{item[0].nbtickets}}</div>
<div class="col-md-2 maintenance text-center">{{item[0].tickmaintenance}}</div>
<div class="col-md-2 assistance text-center">{{item[0].tickassistance}}</div>
</li>
</ul>

在我的 Controller 中,我只是这样做:

$scope.customarray = data;

这里的数组我通过{{item}}(解析我的数组非常大)来显示它

[
{"username":"Eugenie Martin","tickassistance":4,"tickbug":0,"tickmaintenance":3,"nbtickets":7,"id":660302971,"tickets":[{"date":"2015-09-29T07:12:14Z","titre":"Changement date de clôture dossier Barbe Alain","status":"closed","tag":"maintenance"},
{"date":"2015-09-04T09:45:20Z","titre":"43325- NH DISTRIBUTION","status":"closed","tag":"assistance"},
{"date":"2015-08-20T06:18:04Z","titre":"TR: EURL NH DISTRIBUTION vous a envoyé un message depuis sa plateforme","status":"closed","tag":"assistance"},{"date":"2015-02-25T16:00:46Z","titre":"Votre demande au support sans suite","status":"closed","tag":"assistance"},
{"date":"2015-01-12T06:48:35Z","titre":"Bonjour,\n\nle cabinet AUFICOM aura un stand lors du...","status":"closed","tag":"assistance"},
{"date":"2014-12-18T09:48:38Z","titre":"ISACOMPTA","status":"closed","tag":"maintenance"},{"date":"2014-12-15T14:08:08Z","titre":"changement date de clôture","status":"closed","tag":"maintenance"}],
"monthly":[{"now11":0,"assist":0,"maint":0},
{"now10":0,"assist":0,"maint":0},
{"now9":1,"assist":1,"maint":0},
{"now8":2,"assist":1,"maint":1},
{"now7":0,"assist":0,"maint":0},
{"now6":0,"assist":0,"maint":0},
{"now5":0,"assist":0,"maint":0},
{"now4":0,"assist":0,"maint":0},
{"now3":0,"assist":0,"maint":0},
{"now2":0,"assist":0,"maint":0},
{"now1":0,"assist":0,"maint":0},
{"now":0,"assist":0,"maint":0}]},
[{"date":"2015-09-29T07:12:14Z","titre":"Changement date de clôture dossier Barbe Alain","status":"closed","tag":"maintenance","id":660302971,"name":"Eugenie Martin"},
{"date":"2015-09-04T09:45:20Z","titre":"43325- NH DISTRIBUTION","status":"closed","tag":"assistance","id":660302971,"name":"Eugenie Martin"},
{"date":"2015-08-20T06:18:04Z","titre":"TR: EURL NH DISTRIBUTION vous a envoyé un message depuis sa plateforme","status":"closed","tag":"assistance","id":660302971,"name":"Eugenie Martin"},
{"date":"2015-02-25T16:00:46Z","titre":"Votre demande au support sans suite","status":"closed","tag":"assistance","id":660302971,"name":"Eugenie Martin"},
{"date":"2015-01-12T06:48:35Z","titre":"Bonjour,\n\nle cabinet AUFICOM aura un stand lors du...","status":"closed","tag":"assistance","id":660302971,"name":"Eugenie Martin"},
{"date":"2014-12-18T09:48:38Z","titre":"ISACOMPTA","status":"closed","tag":"maintenance","id":660302971,"name":"Eugenie Martin"},
{"date":"2014-12-15T14:08:08Z","titre":"changement date de clôture","status":"closed","tag":"maintenance","id":660302971,"name":"Eugenie Martin"}]
];

最佳答案

你试过吗?

<ul ng-repeat="item in customarray | orderBy:'nbtickets':true track by $index">

angular orderBy 中有一个反向选项,也就是上面的 :true 部分。

关于angularjs - ng-repeat 中 angularjs 中的 orderBy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37203725/

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