2017-04-10 9 views

답변

-1

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> 
 
<ui-select allow-clear ng-model="hotelsCtrl.companySelectedInsert" theme="bootstrap"> 
 
       <ui-select-match placeholder="Select or search company in the list...">{{$select.selected.name}}</ui-select-match> 
 
       <ui-select-choices repeat="company in hotelsCtrl.companies | filter: $select.search"> 
 
        <span ng-bind-html="company.name | highlight: $select.search"></span> 
 
       </ui-select-choices> 
 
      </ui-select>
직진 방법 ui-select로 설정하기 전에 hotelsCtrl.companies에 널 (Null) 값으로 추가하고 소자한다. 이 같은

뭔가 : 여기

가 작동 예입니다 백 스페이스 사용 후 선택 한 번만 옵션 중 하나를 재설정 할 어쩌면 경우

{ 
     name:'none', 
     value:null 
    } 

, http://jsfiddle.net/Miqe/x6bqubtw

+0

이 체크 아웃 회사 = [{name : 'none', value : null}]; 이것을 내 호텔에 추가했습니다. Ctrl. 그러나 여전히 작동하지 않습니다. – Senpuki

+0

는'hotelsCtrl.companies' 배열의 샘플 요소를 보여줍니다. – Miqe

+0

배열이 비어 있습니다. 나는 데이터베이스에서 회사를 얻고있다. – Senpuki