// 已分配区域的数组
$scope.already_assigned = [{"zone":"1","district":"2"}];
// 所有地区的数组
$scope.all_districts = [{"districtId":"1","districtName":"All Districts","stateId":"1"},{"districtId":"2","districtName":"District 09","stateId":"7"},{"districtId":"3","districtName":"District 10","stateId":"7"},]
//HTML
<table>
<tr ng-repeat="list in all_districts">
<td>
<input type="checkbox" ng-checked="checkAlreadyAssigned(list.districtId)" > </td>
</tr>
</table>
如何制作类似于 checkAlreadyAssigned(list.districtId) 的函数。此函数应获取地区 ID 并检查此地区 ID 是否存在于 already_assigned 数组中,如果是则返回 true 或返回 false。请。