简体   繁体   中英

Inner ng-repeat inside ng-repeat

I would like to ask how to use in right way inner ng-repeat inside of the outer ng-repeat:

It means taht u would like to use something like this:

  <tr  ng-repeat="milestone in order.milestones">
            <td>{{milestone.id}}</td>
            <td>{{milestone.milestoneTemplate.name}}</td>
            <td>{{milestone.actual}}</td>
            <td>{{milestone.estimate}}</td>
            <td>
              <span ng-repeat="milestoneTemplate in order.milestones.milestoneTemplate">
                {{milestoneTemplate.warningAttributes.id}}
              </span>
            </td>

            <td><a href="" ng-click="removeProjectFromTeam($parent.selected=$index)">{{ 'remove' | translate }}</a></td>
          </tr>

Thanks for any advice.

Since milestone is already iterating over order.milestones in the top loop, simply do:

ng-repeat="milestone in order.milestones"
    ng-repeat="milestoneTemplate in milestone.milestoneTemplate"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM