At first I have to say I'm new to AngularJS but I have to modify a web app, that is to nest list inside another:
<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>
I received an array of objects (JSON) like this:
[{
"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 O2170 Plafon Nekko nowoczesny Nekko O2171 Plafon Nekko nowoczesny Nekko O2172 Plafon Nekko nowoczesny Nekko O2173 Plafon Nekko nowoczesny Nekko O2174 Plafon Nekko nowoczesny Nekko O2175 Plafon Nekko nowoczesny Nekko O2176 Plafon Nekko nowoczesny Nekko O2177 Plafon Nekko"
},...]
I need to put parent at first level and its children at second level, and when the loop finds another parents it should create another first-level li and so on.
I need to associate style property (parent) with name property (child) How can I force ng-repeat to go back to level one when it finds another parent value?