user6728173 user6728173 - 6 months ago 33
AngularJS Question

How to iterate through a multidimensional JSON array?

My code is:

<div class="modal-body">
<p ng-repeat="maintGroup in maintGroups"> Some text in the modal and {{[$index].description.custDescription }} </p>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

maintGroup refers to the following JSON data:

"custDescription":"Replace right front brake motor",

I'm struggling to find a way to loop through the customer descriptions. I know the paths should be:[0].description.custDescription where 0 should be i. I just don't know how to get it to work. $index only works for index 0, but doesn't loop for the rest of ng-repeat.


I think you are going to want to nest another repeat inside your ng-repeat="maintGroup in maintGroups"

Try adding an element with ng-repeat='service in', and then somewhere inside of that you can call {{ service.description.customerDescription }}