Pease帮我控制器。 rails应用程序页面选择:系统和系统组。系统有设备,系统组有系统。当我选择一组系统时,我希望看到属于该组的所有系统的设备。目前,只有在选择系统的情况下才会显示设备。
$scope.loadEquipments = (complex_id, object) ->
if object == 'group'
$scope.systems = SystemResource.where
ppr_group_system_id: complex_id
# load equipment of system
$scope.equipments = EquipmentResource.where
ppr_system_id: $scope.systems
else if object == 'system'
# load equipment of system
$scope.equipments = EquipmentResource.where
ppr_system_id: complex_id
else
$scope.equipments = []
$scope.equipment_works = []
如何获取$ scope.systems的ID?或者怎么做?
方法EquipmentFactory:
where: (params, successHandler) ->
@service.query
ppr_equipment: params
((equipments) -> successHandler?(equipments))
@errorHandler
查看:
<div class='form-group'>
<label class='control-label' for='issue_service_id'>System</label>
<select required class='form-control' id='current_system' data-ng-model='current_system'
data-ng-options='system.id as system.title for system in systems'
data-ng-change="loadEquipments(current_system, 'system')">
<option value=''>Select system</option>
</select>
</div>
群组的相同观点。