0

I am trying to do collapsing <ul></ul> - after click age i want to collapse under name and then the deeper json structure. Now i am in that moment :

 <div ng-repeat="key in messages">
  <ul ng-repeat=" (x, y) in key">
   <li>{{y.age}}</li>
  <li style="margin-left:15px;" ng-repeat="(a,b) in y.names" >{{b.name}}</li>
  <ul style="margin-left:35px;" ng-repeat="p in a.full_name" >
       <li>{{p}}</li>
          </ul>
          </ul>
  </div>

My plunker : http://plnkr.co/edit/902dF10onLRdAvo3gRBa?p=preview

I don't know how to get full_names from json. Thanks for answers in advance!

bafix2203
  • 541
  • 7
  • 25
  • your `ng-repeat` with `(a,b)` was closed too early, so the second `ng-repeat` with `a.full_name` doesn't have a reference to `a` – Aleksey Solovey Jul 31 '18 at 11:19
  • @AlekseySolovey Yeah, thank you. Have you maybe idea for collapse this json? You know after click y.age toggle the b.name – bafix2203 Jul 31 '18 at 11:27
  • 2
    your JSON makes very little sense. I think it's better to structure it differently - per _user_, with some properties like name, age, full_name, etc. Then you can [`groupBy`](https://stackoverflow.com/a/24879563/8495123) it in `ng-repeat` – Aleksey Solovey Jul 31 '18 at 11:30

0 Answers0