Jithin Sebastian Jithin Sebastian - 1 year ago 107
AngularJS Question

Using multiple ng-repeat

<table class="table table-striped">
<th ng-repeat="header in headers">{{header}}</th>
<tr ng-repeat="table in tables">
<td ng-repeat="header in headers">{{$parent.table.header}}</td>

I have a json array retrieved from a server. First ng-repeat: 'headers' contain keys in that json array which i extracted. It works fine in all cases.
Second ng-repeat: 'tables' contain the json array received. What i am trying to do is for each element of json array, find data by providing key values.
here is my multiple ng-repeat code. This doesn't work, no data is printed in the table but if i change
i can see data in the table.
The problem is
how can i do it correctly ?

Answer Source

Try to use $parent.table[header] - because header is already a string.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download