Ania Ksyta Ania Ksyta - 1 year ago 83
HTML Question

single th in tr with ng-repeat

Cant I display one value of th element in tr with ng-repeat?

This is how my html looks

<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>
<div class="simple-table-container md-whiteframe-4dp">
<div class="ms-responsive-table-wrapper">
<table class="simple" ms-responsive-table>
<th class="text-center">Action</th>
<tr ng-repeat-start="movie in vm.movies">
<td>{{ movie.title }}</td>
<td>{{ movie.year }}</td>
<td>{{ }}</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>
<tr ng-repeat-end ng-show="movie._detailsVisible" ng-repeat="detail in vm.movieDetails">
<th>Actors: </th>
{{ }}

enter image description here

I want to display "Actors:" like a title of all tds, something like that:

enter image description here

How can I do this?

Answer Source

Just move ng-repeat to td

<tr ng-repeat-end ng-show="movie._detailsVisible">
      <th>Actors: </th>
      <td ng-repeat="detail in vm.movieDetails">
        {{ }}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download