AngryJS
AngryJS

Reputation: 955

iterate hasmap with ng-repeat. Hashmap with array as value

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

Answers (1)

Shasha
Shasha

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

Related Questions