I have a table of data each with a checkbox. Any row that is checked moves into a second table for processing (processing not shown). I want the second table hidden unless it has rows but can't seem to figure out the ng-show. (Updated to show the need to hide the second table)
Here's the updated jsfiddle example.
Here's my html (I have the line that doesn't work commented out):
<span>Table One</span>
<div ng-controller="checkBoxCtrl">
<table width="400" border="1">
<tr>
<th>✔</th>
<th>Key</th>
<th>Value</th>
</tr>
<tr ng-repeat="data in tableOne" id="item{{data.key}}">
<td width="20px">
<input type="checkbox" ng-model="data.checked">
</td>
<td>{{data.key}}</td>
<td>{{data.value}}</td>
</tr>
</table>
<br>
<!--<div ng-show="tableOne.key.checked == true"> -->
<div>
<span>Table Two</span>
<table width="400" border="1">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr ng-repeat="data in tableOne | filter: {checked:true}">
<td>{{data.key}}</td>
<td>{{data.value}}</td>
</tr>
<tr>
<td colspan="2">
<button>New Group</button>
</td>
</tr>
</table>
</div>
and here's the javascript:
var app = angular.module('myApp', []);
function checkBoxCtrl($scope){
$scope.tableOne=[
{key: '1', value: 'a'},
{key: '2', value: 'b'},
{key: '3', value: 'c'},
{key: '4', value: 'd'}
];
};
ng-showto the<tr>element if you want to hide the row from the first table as it is checked. jsfiddle.net/6chnJ