I would like to do this really basic example :
<div ng-controller="ctrl">
<li ng-repeat="config in configs">
<span >Config : {{config}}</span>
<li ng-repeat="version in versions">
{{config}}
</li>
</li>
</div>
So basically, I got 2 imbricated ng-repeat
loop, and I would like to access a value of the first loop from the second one. I thought it was really basic, but no way to make it work. My result of that is 1 li
with the config printed, and 3 empty sub li
s I already tried a lot of combination list {{$parent.index}}
, {{$parent.config}}
etc ...
I'm pretty sure this has to do with the structure of your HTML.
Since you are omitting the <ul>
tags that are required for lists. The nested <li>
is causing a display issue.
I have simple wrapped the <li>
with <ul>
and it seems to work fine:
<div ng-controller="ctrl">
<ul>
<li ng-repeat="config in configs">
<span >Config : {{ config }}</span>
<ul>
<li ng-repeat="version in versions">
VersionConfig: {{ config }}
</li>
</ul>
</li>
</ul>
</div>
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.