2016-09-26 11 views
-1

angualrjsでネストされたng-repeatを使用していて、内側のng-repeat配列の長さが異なります。したがって、インデックスは順番に表示されません。 インデックスの出力が順番に必要です。出力のスクリーンショットを添付しました。内側のng-repeat配列が異なる場合、ng-repeat内のインデックス値ng-repeat配列が異なる場合

誰でも手伝ってもらえますか?

<table class="table"> 
    <thead> 
      <th>#($index)</th> 
      <th>L #</th> 
      <th>C Name</th> 
      <th>A #</th> 
      <th>F P</th>       
    </thead> 
    <tbody ng-repeat="d in displayData" > 
     <tr ng-repeat="a in d.f_p track by $index" > 
      <td>{{($parent.$index*d.f_p.length)+($index+1)}}</td> 
      <td>{{d.lId}}</td> 
      <td>{{d.cName}}</td> 
      <td>{{$index+1}}</td> 
      <td>{{a}}</td>  
     </tr>  
</tbody> 
</table> 

$scope.displayData=[{"lId": "369857","cName": "ABCD","f_p":0.04401,0.04402,0.04403]},{"lId": "369858","cName": "BCDE",   "f_p":[0.04401,0.04402,0.04403,0.04404]},{"lId": "369859","cName": "CDEF",     "f_p":[0.04401,0.04402,0.04403,0.04404,0.04405]}]; 

enter image description here

+0

あなたはjsfiddleを作成でき –

+0

我々は中に気づくことになっているものスクリーンショット?問題は明確ではなく、どちらもあなたが期待するものではありません – charlietfl

答えて

0

これはNG-のinitのための唯一の有効な場合です:あなたのJSONオブジェクトが有効でないようなので、

<tbody ng-repeat="d in displayData" ng-init="$outerIndex = $index"> 
関連する問題