我有一些表格html,并且难以从多个级别的json数据重复。
我有TR工作,在TD中创建一个员工姓名列表,但是我不能在每个第一行缺席时为每个时间戳创建第二个TD重复,这应该创建7个TD。
知道我可能做错了什么吗?
输出我想:
| DisplayName | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
人员个历表row.html
<tr ng-repeat="row in d.Employee">
<td>{{row.Details.DisplayName}}</td>
<td ng-repeat="absence in row.Absence[0].Timestamp">cell - {{$index}}</td>
</tr>
Json数据:
{
"d": {
"__type": "IntegratedCalendarDetails:#Common.Entities.Integrated_Calendar",
"Employee": [{
"__type": "Employee:#Common.Entities.Integrated_Calendar",
"Absence": [{
"__type": "Absence:#Common.Entities.Integrated_Calendar",
"Timestamp": ["\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/", "\/Date(1443650400000+0200)\/", "\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/"],
"Type": "Vacation Leave"
}
],
"Details": {
"__type": "User:#Common.Entities",
"DisplayName": "Alan"
}
}, {
"__type": "Employee:#Common.Entities.Integrated_Calendar",
"Absence": [{
"__type": "Absence:#Common.Entities.Integrated_Calendar",
"Timestamp": ["\/Date(-62135596800000)\/", "\/Date(1443477600000+0200)\/", "\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/"],
"Type": "Other Leave"
}
],
"Details": {
"__type": "User:#Common.Entities",
"DisplayName": "Alistair"
}
}, {
"__type": "Employee:#Common.Entities.Integrated_Calendar",
"Absence": [{
"__type": "Absence:#Common.Entities.Integrated_Calendar",
"Timestamp": ["\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/", "\/Date(1443736800000+0200)\/", "\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/"],
"Type": "Vacation Leave"
}, {
"__type": "Absence:#Common.Entities.Integrated_Calendar",
"Timestamp": ["\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/", "\/Date(1443564000000+0200)\/", "\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/"],
"Type": "Working from Home"
}
],
"Details": {
"__type": "User:#Common.Entities",
"DisplayName": "Andrew"
}
}
]
}
}
表格HTML:
<table class="table table-bordered">
<thead class="thin-border-bottom" staff-calendar-table-head></thead>
<tbody staff-calendar-table-row></tbody>
</table>
指令代码:
module.directive('staffCalendarTableRow', [function(){
return {
restrict: 'A',
templateUrl: 'features/staff-calendar/partials/staff-calendar-table-row.html',
controller: function($scope) {
},
controllerAs: 'StaffCalendarController'
}
}]);