E
E
enchikiben2016-04-14 21:57:34
Angular
enchikiben, 2016-04-14 21:57:34

How to display a multidimensional array as a table in AngularJS?

Good evening!
There is such an array:

var arr = [
{
  'name':'aaa',
  'rows':[
    {'name':'bbb'},
    {'name':'ccc'}
  ]
},
{
  'name':'ggg',
  'rows':[
     {'name':'rrr'},
     {'name':'rrradasd'}
   ]
}
]

how to output it like this:
aaa
bbb
ccc
ggg
rrr
rrradasd

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nicholas, 2016-04-14
@healqq

option 1 : convert to normal and output
option 2:
Through nested ng-repeat:

<div ng-repeat = "item in ctrl.items">
    {{item.name}}
    <div ng-repeat = "row in item.rows">
         {{row}}
    </div>
</div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question