search

Home  >  Q&A  >  body text

angular.js - angular ng-repeat sorts the values ​​from small to large by size

Use ng-repeat to sequentially sort p according to the index value in the returnbanner from small to large. How to do it?

滿天的星座滿天的星座2871 days ago872

reply all(1)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-15 17:10:14

    Ascending order:

    <ul>
        <li ng-repeat="user in users | orderBy:user.index">{{user.name}}</li>
    </ul>

    Reverse order:

    <ul>
        <li ng-repeat="user in users | orderBy:user.index:'desc'">{{user.name}}</li>
    </ul>

    Read more official documents...

    reply
    0
  • Cancelreply