I am working with a nested JSON object array and successfully displaying Inner Items grouped by Info in HTML using ng-repeat. Each Inner Item has a checkbox with an ng-click event handler that passes the selected Inner Items to the controller. However, I now want to also pass the Info id in the ng-click event. Is there a way to concatenate the Info array to the Inner items array in the ng-click?
Here is the structured JSON data:
[
{
"Info": {
"id": "a1",
"name": "a1-Info",
"InnerInfo": [
{
"name": "xyz"
}
]
},
"InnerItems": [
{ "id": "i1" },
{ "id": "i2" }
]
}
]
<tr ng-repeat=“I in MyData">
<td> {{I.Info.name}}
<table>
<tr><td>
<div ng-repeat=“item in I.InnerItems ">
<input type="checkbox" name="values" ng-click=“getInfo(I);getInnerItems(item)” ng-true-value="1" ng-false-value="0"/>{{item.name}}
</div>
</td>
</tr>
</table>
</td>
</tr>
Instead of the current method, I am looking for suggestions on how to pass both arrays to one function. Any ideas?