I have json file called brands.json:
{
"brands": {
"Honda": [
"Accord",
"Civic"
],
"Porsche": [
"Cayenne",
"Cayman"
]
}
}
Im trying to iterate through this list and list the brand(e.g. Honda and Porsche) and render using HTML lists.
<li ng-repeat="brands in items">{{brands}}</li>
JS:
$scope.items= [];
$http.get('brands.json').then(function(response) {
$scope.items =response.data.brands;
});
This code works fine but it displays the arrays inside the brand names e.g. instead if displaying Honda it displays ["Accord", "Civic"]. I want it to display the brand names only.
<li>Honda</li>
<li>Porsche</li>