Angularjs 限制和肮脏的不工作

Angularjs 限制和肮脏的不工作,angularjs,sorting,angularjs-limitto,Angularjs,Sorting,Angularjs Limitto,我在一篇文章中有两个问题: 我想用10个结果限制结果的数量,我想按日期对帖子进行排序,但它不起作用,因为它先按用户排序,然后按日期排序,我想按日期排序,不管用户是谁 以下是我所尝试的: <ul ng-repeat="item in customarray | orderBy:'-tickets[0].date' | limitTo : 10 track by $index"> <div ng-repeat="new in item.tickets track b

我在一篇文章中有两个问题: 我想用10个结果限制结果的数量,我想按日期对帖子进行排序,但它不起作用,因为它先按用户排序,然后按日期排序,我想按日期排序,不管用户是谁

以下是我所尝试的:

<ul ng-repeat="item in customarray  | orderBy:'-tickets[0].date' | limitTo : 10 track by $index">
    <div  ng-repeat="new in item.tickets   track by $index ">
        <li class="row"><div class="col-md-2 date text-center">{{new.date | date}}</div><div class="col-md-3 date text-center"> {{item.username}}</div> <div class="col-md-5 date text-center">{{new.titre}}</div> <div class="col-md-2 date text-center">{{new.status}}</div></li>
    </div>
</ul>
  • {{new.date | date}{{item.username}{{{new.titre}}{{new.status}
问题是我的数据包含在2ng repeat中。

我认为应该是这样的

ng repeat=“customarray中的项目按$index跟踪| orderBy:”-票证[0]。日期“|限制到:10”

ng repeat=“customarray中的项目|订购人:'-tickets[0]。日期'|限制为:10”

不需要按$index添加track,因为它会自动按$index跟踪

ng repeat=“customarray中的项目按$index跟踪| orderBy:”-票证[0]。日期“|限制到:10”

ng repeat=“customarray中的项目|订购人:'-tickets[0]。日期'|限制为:10”


无需添加按$index跟踪,因为它将自动按$index跟踪

我认为它应该是
ng repeat=“customarray中的项目按$index跟踪| orderBy:”-tickets[0]。date'| limito:10“
ng repeat=“customarray中的项目| orderBy:”-tickets[0]。date'| limito:10”
无需添加按$index跟踪,因为它将自动按$index跟踪。我认为它应该是
ng repeat=“customarray中的项目按$index跟踪”| orderBy:“-票证[0]。date'| limito:10”
ng repeat=“customarray中的项目| orderBy:”-票证[0]。date'| limito:10”
无需添加按$index跟踪,因为它将自动按$index跟踪