I have this JSON structure like this:
{
"products": {
"318": {
"id": 318,
"product_id": 32,
"sold_by": 1,
"sold_from_date": 1452075077,
"sold_to_date": 1459937477,
"product_price": "1,200",
"renewed_for": 0,
"renewed": {
"319": {
"id": 319,
"product_id": 32,
"sold_by": 1,
"sold_from_date": 1452075077,
"sold_to_date": 1459937477,
"product_price": "1,200",
"renewed_for": 318
}
}
}
}
}
To print the data, I have to loop through two ng-repeat
the first is the outer loop to print the details of 318. Next is 319, which is parent of 318. Parent is decided through renewed_for
index.
In the first block of ng-repeat, I have some options like edit and delete. On clicking these, a pop-up opens. In the second (inner) block of ng-repeat, options are same for edit and delete.
<div ng-repeat=data in products>
<div class=edit ng-click="showEdit = true">
</div>
<div ng-repeat=renew in data>
<div class=edit ng-click="showEdit = true">
</div>
</div>
<div class="modal" ng-show="showEdit">
<div class="product_price">{{data.product_price}}</div>
</div>
</div>
The showEdit popup works only for outer loop, and not for the inner (renew) loop.
EDIT: Now, when I open the pop-up from the inner loop(renew), the value that I get in it is the value of outer loop (data). How to solve this??