I've posted my code below along with the JSON data I want to display. Specifically, I want to be able to do {{client.label}} and have the clients in a list. Unfortunately the only thing that works is when I do {{client}} which gives me the entire JSON object, which I don't want. I'm new to Angular, and I know I'm obviously doing something wrong but I'm not quite sure what. Any help is appreciated!
<body ng-controller="myController">
<ul>
<li ng-repeat="client in userData">
{{client.label}}
</li>
</ul>
<script>
var app = angular.module('myApp', []);
app.controller("myController", function ($scope, $http) {
$http({
url: 'myURL/blah/blah',
method: 'POST',
data: {
common: { clientName: '6012' },
qualifier: '$ALL.$ALL.$ALL.$ALL.$ALL',
pattern: 'configs\\..*'
},
headers: { 'Content-Type': 'application/json' }
}).success(function(data) {
$scope.userData = data;
});
});
</script>
</body>
{
"data": {
"parameters": [
{
"qualifier": "$ALL.$ALL.$ALL.$ALL.$ALL",
"key": "themes",
"value": {
"amairlines": {
"id": "amairlines",
"label": "American Airlines"
},
"amazonfork": {
"id": "amazonfork",
"label": "Amazon Fork"
},
"bestbuy": {
"id": "bestbuy",
"label": "Best Buy"
},
"botw": {
"id": "botw",
"label": "Bank of the West"
},
"bbva": {
"id": "bbva",
"label": "BBVA"
},
"redleaf": {
"id": "redleaf",
"label": "Red Leaf"
},
"citi": {
"id": "citi",
"label": "Citi"
},
"costco": {
"id": "costco",
"label": "Costco"
},
"firstcitizens": {
"id": "firstcitizens",
"label": "First Citizens"
},
"publix": {
"id": "publix",
"label": "Publix"
},
"homedepot":{
"id": "homedepot",
"label": "Home Depot"
},
"hsbc": {
"id":"hsbc",
"label": "HSBC"
},
"huntington": {
"id": "huntington",
"label": "Huntington"
},
"kohls": {
"id": "kohls",
"label": "Kohls"
},
"nordstrom": {
"id": "nordstrom",
"label": "Nordstrom"
},
"paypal": {
"id": "paypal",
"label": "PayPal"
},
"primax": {
"id": "primax",
"label": "Primax"
},
"td": {
"id": "td",
"label": "Toronto Dominion"
},
"usaa": {
"id": "usaa",
"label": "USAA"
}
}
}
]
}
}
ng-repeatin the HTML to iterate over the list.