javascript - multiples ng-repeat for populate table -


im trying populate same table values different scope variables. , b have same lenght.

$scope.a = [1,2,3]  $scope.b = [4,5,6]
<table>    <thead>      <tr>        <th>a</th>        <th>b</th>      </tr>    </thead>    <tbody>      <tr ng-repeat="itema in a, itemb in b"> <!-- how should ng-repeat?-->        <td>{{itema}}</td>        <td>{{itemb}}</td>      </tr>    </tbody>  </table>

the result should table like:

a - b

1 - 4

2 - 5

3 - 6

if can assume 2 array have same length:

<table>   <thead>     <tr>       <th>a</th>       <th>b</th>     </tr>   </thead>   <tbody>     <tr ng-repeat="itema in track $index">        <td>{{itema}}</td> <!--could a[$index] -->       <td>{{b[$index]}}</td>     </tr>   </tbody> </table> 

all tracks array , index, , uses index necessary element in b.


Comments