My experience with AngularJS is limited, but I am tasked with modifying a web app that requires nesting lists inside each other:
<ul class="first-level">
<li ng-repeat="item in list">{{item.parentNo1}}
<ul class="level-2">
<li ng-repat="item in list">{{item.childOfCurrentParent}}</li>
. . .
</ul>
</li>
<li ng-repeat="item in list">{{item.parentNo2}}
<ul class="level-2">
<li ng-repat="item in list">{{item.childOfCurrentParent}}</li>
. . .
</ul>
</li>
</ul>
A JSON array of objects was provided to me in the following format:
[{
"id": 53,
"nazwa": "Plafon Nekko",
"foto": "01/01 _ Koma Nekko.jpg",
"visible": 0,
"cat_id": 1,
"strona": 1,
"styl": "nowoczesny",
"rodzina": "Nekko",
"kod": "O2177",
"bookmark": true,
"title": "nowoczesny Nekko",
"page": 1,
"image": "/lemir/www//gazetka/01/01 _ Koma Nekko.jpg",
"width": 849,
"height": 1201,
"tags": "nowoczesny Koma O2180 Plafon Koma nowoczesny Koma O2181 Plafon Koma nowoczesny Koma O2182 Plafon Koma nowoczesny Koma O2183 Plafon Koma nowoczesny Koma O2184 Plafon Koma nowoczesny Koma O2185 Plafon Koma nowoczesny Koma O2186 Plafon Koma nowoczesny Koma O2187 Plafon Koma nowoczesny Nekko O...
},...]
I must arrange the parents at the first level and their children at the second level. A new parent should create another first-level li
. Additionally, I need to link the style property (parent) with the name property (child).
Is there a way to make ng-repeat return to the first level when encountering a new parent value?