I have an html table, <tbody>
of it is generated with angular ng-repeat
. Here is my html:
<tbody>
<tr ng-repeat-start="car in carList | filter:tableFilter" ng-click="activeRow = car.name">
<td><a target="_blank" href="{{car.carLink}}">{{car.name}}</a></td>
<td>{{car.review}}</td>
<td>{{car.rating}}</td>
<td>{{car.fiveStarPercent}}</td>
<td>{{car.recommended}}</td>
<td>{{car.price}}</td>
</tr>
<tr ng-repeat-end ng-show="activeRow==car.name">
<td>{{car.name}}</td>
</tr>
</tbody>
I need to do so when you click on the row, new row is showing up, but when you click on another row I need the first one to hide.
Here is table in browser with an active row:
I have tried to do this with ng-show
like this:
ng-show="activeRow==car.name"
activeRow
is a $scope
variable inside of my controller. The problem is, that new row is showing up, but not hiding when you click on another.
How can I fix that?