我有这个表格,需要过滤ng-repeats
<tbody ng-repeat="item in model | limitTo: limits track by $index | filter: { UserId: filter.User, Type: filter.Type}">
<tr class="timesheet-day-block">
<td colspan="6">
<span class="timesheet-date">{{item.TaskDate | dateFilter}}</span>
</td>
</tr>
<tr class="timesheet-table-rows" ng-repeat="list in item.TimesheetList" ng-form="logged">
<td>{{list.ProjectName}}</td>
<td>{{list.UserName}}</td>
<td>{{list.Date | date: 'dd/MM/yyyy'}}</td>
<td>{{list.Task}}</td>
<td>{{list.TimeWorked}}</td>
<td>
<span style="width: 85%">{{list.Note}}</span>
<button class="active-delete-button" ng-click="removeTask(list)" style="display: inline-block; float:right">✖</button>
</td>
</tr>
</tbody>
如果我将过滤器添加到第二次重复过滤,但timesheet-day-block
仍然可见,但之后没有数据。当没有TimesheetList数据时,我需要隐藏该块,并试图通过将我的过滤器移动到第一次ng-repeat来解决这个问题,但它无法正常工作。
我的数据如下:
{
"TaskDate": "2015-01-04T00:00:00",
"TimesheetList": [
{
"WorkItemId":24,
"ProjectId":3,
"ProjectName":"Hello world",
"UserId":12,
"UserName":"Juliya Pogrebnaya",
"Date":"2015-01-04T22:00:00",
"Task":"#34 : drfth",
"TimeWorked":56754.0,
"Note":null,
"InProgress":false
}
]
}
我已经设置了plunker。