jsonangularangularjs-ng-repeat

Angular Show ng-repeat Key


I need to display the key in the products AL200W401 (without xxxx) using ng-repeat. in my HTML code its displaying the AL200W401xxxx. How to go about this thanks.

JSON

{  
    "kits":"B11D0W201,AL200W401",
     "dateTo":"13/12/2016",
     "orders":[  
         {  
             "AL200W401":1,
             "B11D0W201":0,
             "date":"13 Dec 16"
         }
     ],
    "dateFrom":"12/12/2016",
    "products":[  
    {  
        "AL200W401":"AL200W401xxxx",
        "B11D0W201":"B11D0W201xxxx"
    }
    ]
}

HTML

<th ng-repeat="column in products">{{column}}</th> 

Solution

  • There is other similar questions where solution is sited. Check this for example

    So you can do it this way:

    <th ng-repeat="(key,value) in products[0]">{{key}}</th>
    

    Please check this working demo: https://jsfiddle.net/hd84335/j0dr7bbp/