2014-10-22 1 views
3

내 테이블에 Angular acute-select를 사용하려고합니다. 나는 힘든 시간을 보내고있다. github의 데모는 큰 문제가 아니므로 계속 진행되는 작업을 많이 볼 수 없습니다. 나는 이것을 plunkr에서 어떻게 설정해야하는지 모르겠다. JSON을 어떻게할지는 모르겠다. 내가 지금 가고있는 것에 오류가 있습니다. 그러나 나는 컨트롤러에서 데이터를 가져 오지 않을 것이라고 믿습니다. 어떤 도움이라도 좋을 것입니다. 감사angle acute-select를 설정하는 방법

<tbody> 
<td> 
    <select class="ac-select stateList" ac-model="currentItem.JobItems[0].JobItemName" ac-options="currentItem.JobItems.JobItemName for currentItem in getAllJobItems()" 
    ac-key="JobItemId" ac-settings="{ initialText: 'Job Items', comboMode:true, loadOnOpen: true, minWidth: '300px', allowClear: false }" ng-enter="selectJobItem();addRecord()"></select><br /> 
</td> 
<td>{{currentItem.JobItems.JobItemDescription}}</td> 
<td>{{currentItem.JobItems.JobItemMatSize}}</td> 
</tr> 
</tbody> 

컨트롤러

//GET Jobs 
$scope.jobArray = {}; 
JobGet.query().then(function (data) { 
    $scope.jobArray = data; 
}, function (reason) { 
    errorMngrSvc.handleError(reason); 
}); 

// Return All Job Items for select Box 
$scope.getAllJobItems = function (callback) { 
    callback($scope.jobArray); 
}; 

//Bind Selected POD JobItems to table fields 
$scope.currentItem = {}; 
$scope.selectJobItem = function (jobItem) { 
    $scope.currentItem.JobItems.JobItemName = jobItem.JobItems[0].JobItemName; 
    $scope.currentItem.JobItems.JobItemDescription = jobItem.JobItems[0].JobItemDescription; 
    $scope.currentItem.JobItems.JobItemMatSize = jobItem.JobItems[0].JobItemMatSize; 
}; 

JSON JSON 오류 메시지 당신이의 속성에 선택의 값을지도하려는 나에게 보인다

ac-options and ac-model attributes must be set <div class="ac-select stateList ac-select-wrapper ng-isolate-scope" ng-keydown="keyHandler($event)" tabindex="999" ac-focus="wrapperFocus" ng-focus="comboFocus = true" ac-model="currentItem.JobItems[0].JobItemName" ac-options="currentItem.JobItems.JobItemName for currentItem in getAllJobItems()" ac-key="JobItemId" ac-settings="{ initialText: 'Job Items', comboMode:true, loadOnOpen: true, minWidth: '300px', allowClear: false }" ng-enter="selectJobItem();addRecord()"> 

답변

2

JobItem. 선택 영역에 이름이 표시되기를 원하지만 선택 영역의 값은 객체 여야합니다. 대신

ac-model="currentItem.JobItems[0].JobItemName" 

대신 객체에 매핑하십시오. 확실히 이름을 만들 수

$scope.selectedJobItem = null; 
... 
ac-model="selectedJobItem" 

사용 AC-옵션은 도움이

ac-options="job.JobItemName for job in someJobCollection" 

희망을 표시됩니다.

+0

맞습니다. 값 또는 'null'이어야합니다. 이 문제는 https://github.com/john-oc/acute-select/issues/25에서 다루고 있습니다. – Niel

관련 문제