我正在开展一个新项目,而且我真的陷入了那个桌子。
有两个对象列表:settingtime
和settings
,
我想用ng-if将它们放在一个单元格中。
但是当我这样做时,它们是重复的,只是制造更多细胞。
*有一件事是每天有7张桌子。这是周日的一个例子。
Ng-如果我想检查的是settingTime.id
何时等于setting.settingTimeid
虽然他们是平等的,但将它们放在一个单元格中。
HTML:
<table class="table table-bordered table-striped">
<tr>
<th>Sunday</th>
</tr>
<tbody ng-repeat="setting in settings">
<tr ng-repeat="settingtime in settingtimes | orderBy:'time' | filter:by_shiftDay" ng-if="settingtime.shiftDay=='SUNDAY'">
<td ng-if="setting.settingTimeId==settingtime.id">
{{settingtime.shiftDay}}
</br>
{{settingtime.time}}
</br>
SettingTimeId: {{setting.settingTimeId}} {{settingtime.id}}
</br>
Role:{{setting.role}}
</br>
WorkerAmount:{{setting.workerAmount}}
<button class="btn btn-primary" ui-sref="editsettingtime" ng-click="EditSettingTime(settingtime.id)">Edit</button>
</br><button class="btn btn-primary" ng-click="getAllRoles(); toggleRight(); saveSettingTime(settingtime.id); showAddSetting()">AddSetting</button>
</td>
</tr>
</tbody>
settingtime: [
{"id":2,"shiftDay":"MONDAY","hours":0,"minutes":0,"time":"12:00"},
{"id":202,"shiftDay":"SATURDAY","hours":0,"minutes":0,"time":"06:00"},
{"id":5,"shiftDay":"FRIDAY","hours":0,"minutes":0,"time":"17:30"},
{"id":4,"shiftDay":"SUNDAY","hours":0,"minutes":0,"time":"19:00"},
{"id":302,"shiftDay":"WEDNESDAY","hours":0,"minutes":0,"time":"15:00"},
{"id":3,"shiftDay":"MONDAY","hours":0,"minutes":0,"time":"06:00"},
{"id":1,"shiftDay":"SUNDAY","hours":0,"minutes":0,"time":"15:00"},
{"id":101,"shiftDay":"TUESDAY","hours":0,"minutes":0,"time":"10:00"},
{"id":201,"shiftDay":"THURSDAY","hours":0,"minutes":0,"time":"12:00"},
{"id":6,"shiftDay":"WEDNESDAY","hours":0,"minutes":0,"time":"10:00"}
]
settings: [
{"id":2,"settingTimeId":4,"role":1,"workerAmount":1},
{"id":4,"settingTimeId":1,"role":4,"workerAmount":3},
{"id":1,"settingTimeId":1,"role":1,"workerAmount":1},
{"id":3,"settingTimeId":1,"role":2,"workerAmount":2}]