How can I access the JSON property name in AngularJS if I don't know what it is?

Given a JSON object (formData), I am trying to skip an object using AngularJS and output RealEstateInfo and PersonalTaxInfo . For my life, I cannot figure out how to get to the name of the property. Any ideas?

By the way, (key, value) does not work. the key gives me the index number, the value of the whole object.

<ul>
    <li ng-repeat="item in formsData">
        {{item.value}} //What goes here to get "RealEstateInfo" the 1st loop, and "PersonalTaxInfo" the second loop?
    </li>
<ul>

$scope.formData = [
{
    "RealEstateInfo": [
    {
        "Group": "General",
        "Fields": [
        {
            "Name": "TitleType",
            "Label": "Title Type",
            "Type": "dropdown",
        },
        {
            "Name": "NameIfAvailable",
            "Label": "Name if available",
            "Type": "string"
        }]
    },
    {
         "Group": "Personal",
         "Fields": [
         {
             "Name": "TitleType",
             "Label": "Title Type",
             "Type": "dropdown",
         },
         {
             "Name": "NameIfAvailable",
             "Label": "Name if available",
             "Type": "string"
         }]
     }]
},
{
    "PersonalTaxInfo": [
    {
        "Group": "General",
        "Fields": [
        {
             "Name": "TitleType",
             "Label": "Title Type",
             "Type": "dropdown",
        },
        {
            "Name": "NameIfAvailable",
            "Label": "Name if available",
            "Type": "string"
        }]
    },
    {
        "Group": "PersonalInfo",
        "Fields": [
        {
             "Name": "TitleType",
             "Label": "Title Type",
             "Type": "dropdown",
        },
        {
             "Name": "NameIfAvailable",
             "Label": "Name if available",
             "Type": "string"
        }]
    }]
}]
+5
source share
1 answer

Please take a look at this fiddle. http://jsfiddle.net/4UTHW/

ng-repeat="(key,value) in data" 

, key value.

json .

+5

All Articles