Angular ng-repeat groupBy and Keep order

前端 未结 3 1810
情书的邮戳
情书的邮戳 2020-12-18 19:47

Im using this filter https://github.com/a8m/angular-filter#groupby to order my data like so, and it works great:

3条回答
  •  太阳男子
    2020-12-18 20:22

    groupBy should always be the last one in the ng-repeat.. so set orderBy first and groupBy last and then you can use track by $index so the normal ng-repeat will be.

    ng-repeat="item in items orderBy:'price' | groupBy:'name' track by $index"
    

    ... Hope it helps even its little late!

提交回复
热议问题