Stop AngularJS ng-repeat rendering in alphabetical order

后端 未结 3 735
抹茶落季
抹茶落季 2021-01-12 20:19

In my angular app I\'m trying to display JSON data in a table. The data looks like this:

$scope.data = 
  {
    \"EVENT NAME\":\"Free Event\",
    \"ORDER ID         


        
3条回答
  •  执笔经年
    2021-01-12 20:54

    Object properties don't have a natural order.

    You can achieve what you're looking for with a slightly different Object:

    $scope.data = 
      {
        columns: [
          {
            "EVENT NAME":"Free Event",
            "priority": 0        
          },
          {
            "ORDER_ID":311575707,
            "priority": 1        
          },
          ...
        ]
      }
    

提交回复
热议问题