2016-08-22 6 views
0

ng-repeatでtrのth要素の1つの値を表示しますか?ng-repeatのtrで1回目

これは私のHTMLは、私は "俳優:" 表示したい

<div class="center layout-column flex"> 
<section layout="row" layout-align="left left"> 
    <md-button class="md-primary" ng-click="vm.showDialogAdd($event)">Add new movie</md-button> 
    <md-button class="md-primary" ng-click="vm.showDialogDetails($event)">Add details</md-button> 
</section> 
    <div class="simple-table-container md-whiteframe-4dp"> 
     <div class="ms-responsive-table-wrapper"> 
     <table class="simple" ms-responsive-table> 
      <thead> 
      <tr> 
       <th>Title</th> 
       <th>Year</th> 
       <th>Country</th> 
       <th class="text-center">Action</th> 
      </tr> 
      </thead> 
      <tbody> 
      <tr ng-repeat-start="movie in vm.movies"> 
       <td>{{ movie.title }}</td> 
       <td>{{ movie.year }}</td> 
       <td>{{ movie.country }}</td> 
       <td class="text-center"> 
       <md-button class="md-warn" ng-click="vm.deleteMovie(movie)">Remove</md-button> 
       <md-button class="md-noink" ng-click="vm.showDetails(movie)">Details</md-button> 
       </td> 
      </tr> 
      <tr ng-repeat-end ng-show="movie._detailsVisible" ng-repeat="detail in vm.movieDetails"> 
       <th>Actors: </th> 
       <td> 
       {{ detail.name }} 
       </td> 
      </tr> 
      </tbody> 
     </table> 
     </div> 
    </div> 
</div> 

enter image description here

どのように見えるかであるすべてのTDSのタイトルのように、そのようなこと:

enter image description here

をこれどうやってするの?

答えて

4

ちょうど私があなたの写真は、私が何を意味するか見追加td

<tr ng-repeat-end ng-show="movie._detailsVisible"> 
     <th>Actors: </th> 
     <td ng-repeat="detail in vm.movieDetails"> 
     {{ detail.name }} 
     </td> 
</tr> 
1

1つのtdに "Actors:"と表示するのはどういう意味かはっきりしていませんが、詳細名の前に追加して値を1つのtdに表示することができます。

編集:下記のコードを試してください。

<tr ng-repeat-end ng-show="movie._detailsVisible"> 
    <th> 
     Actors: 
    </th> 
    <td ng-repeat="detail in vm.movieDetails"> 
    {{ detail.name }} 
    </td> 
</tr> 
+0

ng-repeatを移動 – aks

関連する問題