Tejas Ghonge Tejas Ghonge - 1 year ago 95
AngularJS Question

I am unable to parse the json array using angular ng-repeat

Below is the JSON which I am getting and I am storing that in variable using,


$scope.shopData = resp.data.shopVal;

On the JSP page its not working in ng-repeat tag.


"subCategoryNames": null,
"subCategorymMap": {},
"shopVal": [
"shopAdrs": "tex10",
"shopSrvc": "tex12",
"shopName": "tex13",
"shopWbst": "tex14"
"shopAdrs": "tex15",
"shopSrvc": "tex16",
"shopName": "tex16",
"shopWbst": "tex17"
"shopAdrs": "tex18",
"shopSrvc": "tex19",
"shopName": "tex20",
"shopWbst": "tex21"
"ownerVal": {
"ownrNumbr": "1111111111",
"ownrFName": "ABCD",
"ownrLName": "EFGH",
"ownrEmail": "ABXD305@GMAIL.COM"


<div data-ng-repeat="shop in shopDta">
Address: {{shopDta.shopAdrs}}<br>
Services: {{shopDta.shopSrvc}}<br>
Website: {{shopDta.shopWbst}}<br><br>

Note that $scope.shopData is correctly getting value as per JSON. Please help

Answer Source

Try this one, you are trying to iterate an Object using ng-repeat which is not possible, you need to get the array and put it inside ng-repeat, i have done some changes, hope this works out for you.

<div data-ng-repeat="shop in shopData.shopVal">
Address: {{shop.shopAdrs}}<br>
Services: {{shop.shopSrvc}}<br>
Website: {{sho[.shopWbst}}<br><br>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download