I have JSON data I dont know how to write nested loop in angularJS.In here I am using two $index one is parent and anothe one is for child but its not working to me.
In here priceTag is a nested array.But i cant able to acces this nested array.Please help me to getting this .I am new in angularJS
This is my JSON data
$scope.products=
[
{
"catId": "569df86dd08598371e9b5ad8",
"pname": "ABCD",
"priceTag": [
{
"pModel": "50gm",
"actualPrice": "23",
"offer": 0,
"availablity": "3"
},
{
"pModel": "150gm",
"actualPrice": "23",
"offer": 0,
"availablity": "3"
}
],
"id": "569e0abed08598371ebe5421",
"createdOn": "19-Jan-2016 09:29:26 UTC"
},
{
"catId": "569df86dd08598371e9b5ad8",
"pname": "BACD",
"priceTag": [
{
"pModel": "50gm",
"actualPrice": "23",
"offer": 0,
"availablity": "3"
},
{
"pModel": "150gm",
"actualPrice": "23",
"offer": 0,
"availablity": "3"
}
],
"id": "569e0abed08598371ebe5423",
"createdOn": "19-Jan-2016 09:29:26 UTC"
},
{
"catId": "569df86dd08598371e9b5ad8",
"pname": "CABD",
"priceTag": [
{
"pModel": "25gm",
"actualPrice": "23",
"offer": 0,
"availablity": "3"
},
{
"pModel": "150gm",
"actualPrice": "23",
"offer": 0,
"availablity": "3"
}
],
"id": "569e0abed08598371ebe5424",
"createdOn": "19-Jan-2016 09:29:26 UTC"
},
]
This is my index.html
<div ng-repeat="product in products">
{{$index+1}} {{product.pname}}
<div ng-repeat="ptag in product.priceTag track by $index">
{{$index}} {{ptag.pModel}} {{ptag.actualPrice}}
</div>
</div>