Мой код:
<div class="modal-body">
<p ng-repeat="maintGroup in maintGroups"> Some text in the modal and {{ maintGroup.serviceGroup.services[$index].description.custDescription }} </p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
maintGroup относится к следующим данным JSON:
[
{
"groupId":"MSG1",
"mileage":150000,
"serviceGroup":{
"description":"BRAKES",
"opCode":"BRK",
"serviceGroupId":"SG1",
"serviceType":"BRAKES",
"services":[
{
"description":{
"custDescription":"Replace right front brake motor",
"descriptionId":"D1"
},
"image":{
"imageId":"IMG1"
},
"serviceId":"S1"
}
Я изо всех сил пытаюсь найти способ перебирать описания клиентов. Я знаю, что пути должны быть: maintGroup.serviceGroup.services [0].description.custDescription, где 0 должно быть i. Я просто не знаю, как заставить его работать. $ index работает только для индекса 0, но не работает для остальных ng-repeat.
Я думаю, вам ng-repeat="maintGroup in maintGroups"
еще один повтор внутри вашей ng-repeat="maintGroup in maintGroups"
Попробуйте добавить элемент с помощью ng-repeat='service in maintGroup.serviceGroup.services'
, а затем где-то внутри этого можно вызвать {{ service.description.customerDescription }}