Reputation: 955
How can i iterate below JSON response from server using angularJS on UI using ng-repeat?
$scope.data = {
"Home Needs": [{
"id": 11,
"itemName": "PARLE G 500 Grams",
"itemPrice": 50,
"minSellPrice": 45,
"discount": 0,
"store": "Home Needs"
}],
"SRI SAI Store": [{
"id": 1,
"itemName": "PARLE G 500 Grams",
"itemPrice": 50,
"minSellPrice": 45,
"discount": 0,
"store": "SRI SAI Store"
}],
"Ashirwad": [{
"id": 10,
"itemName": "PARLE G 500 Grams",
"itemPrice": 50,
"minSellPrice": 46,
"discount": 0,
"store": "Ashirwad"
}]
}
Can anyone help me with a jsfiddle please or a pointer please?
thanks
Upvotes: 0
Views: 9365
Reputation: 669
Kindly check Jsfiddle
<div ng-app>
<div ng-controller="ClickToEditCtrl">
<p>Your Data:</p>
<ul ng-repeat="(key, value) in data">
name: {{key}}
<li ng-repeat="v in value">
{{v.id}},
{{v.itemName}},
{{v.itemPrice}},
{{v.minSellPrice}},
{{v.discount}},
{{v.store}}
</li>
</ul>
</div>
</div>
you can modified as u required. I hope this might help.
Upvotes: 5