Underscore: sortBy() based on multiple attributes

后端 未结 11 1182
隐瞒了意图╮
隐瞒了意图╮ 2020-11-27 11:09

I am trying to sort an array with objects based on multiple attributes. I.e if the first attribute is the same between two objects a second attribute should be used to comap

11条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 12:01

    If you happen to be using Angular, you can use its number filter in the html file rather than adding any JS or CSS handlers. For example:

      No fractions: {{val | number:0}}

    In that example, if val = 1234567, it will be displayed as

      No fractions: 1,234,567
    

    Example and further guidance at: https://docs.angularjs.org/api/ng/filter/number

提交回复
热议问题