1

I want to display array value using ng-repeat, and i will call getimage function with itemid and photoidlist to get image url.

My json is:

$scope.productslist = {
  "json": {
    "response": {
      "servicetype": "10",
      "functiontype": "104",
      "statuscode": "0",
      "statusmessage": "Success",
      "data": [
        {
          "itemid": 247,
          "isproduct": true,
          "disable": false,
          "itemcost": 150,
          "itemdescription": "prdct",
          "itemname": "pro1",
          "itemno": "#1Pro",
          "itemcategoryid": 158,
          "itemcategory": "General",
          "addedby": "buzi by pree"
        },
        {
          "itemid": 257,
          "isproduct": true,
          "disable": false,
          "itemcost": 150,
          "itemdescription": "products",
          "itemname": "pro 2",
          "itemno": "pro 2",
          "itemcategoryid": 158,
          "itemcategory": "General",
          "photoidlist": [
            138
          ],
          "addedby": "buzi by pree"
        },
        {
          "itemid": 259,
          "isproduct": true,
          "disable": false,
          "itemcost": 150,
          "itemdescription": "descc",
          "itemname": "pro 1",
          "itemno": "pro 3",
          "itemcategoryid": 158,
          "itemcategory": "General",
          "photoidlist": [
            139, 140
          ],
          "addedby": "buzi by pree"
        },
        {
          "itemid": 262,
          "isproduct": true,
          "disable": false,
          "itemcost": 599,
          "itemdescription": "fgg",
          "itemname": "ff",
          "itemno": "r",
          "itemcategoryid": 158,
          "itemcategory": "General",
          "addedby": "buzi by pree"
        },
        {
          "itemid": 263,
          "isproduct": true,
          "disable": false,
          "itemcost": 56,
          "itemdescription": "ffr",
          "itemname": "rf",
          "itemno": "fe",
          "itemcategoryid": 158,
          "itemcategory": "General",
          "photoidlist": [
            140, 143, 141
          ],
          "addedby": "buzi by pree"
        }
      ]
    }
  }
};

Now I need to iterate over the array using ng-repeat and display all the values with its particular value.

I have created a Fiddle

1 Answer 1

1

Your logic is good, but you are trying to iterate over an object, instead of an array. I think it should be the following:

<tr ng-repeat="item in productslist.json.response.data">
     ...
</tr>

Forked your Fiddle here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.