2016-05-10 21 views
0

fiddle link化妝自動完成搜索下拉不想只是搜索顯示在列表中點擊

<div ng-app="app" ng-controller="myCtrl as vm"> 
<ui-select tagging ng-model="vm.selected" theme="bootstrap"> 
    <ui-select-match p laceholder="Pick one...">{{$select.selected.value}}</ui-select-match> 
    <ui-select-choices repeat="val in vm.values | filter: $select.search"> 
     <span ng-bind-html="val.value | highlight: $select.search"></span> 
    </ui-select-choices> 
</ui-select> 
</div> 


var app = angular.module('app', ['ui.select', 'ngSanitize']); 

app.controller("myCtrl", function() { 
vm = this; 
vm.isLoaded = false; 
vm.values = [{ 
    'key': 22, 
    'value': 'Kevin' 
}, { 
    'key': 24, 
    'value': 'Fiona' 
}]; 
vm.selected; 
}); 

這是做工精細,但現在我要顯示列表只是搜索不想在搜索框中

回答

0

fiddle link

只在搜索詞顯示在點擊一個大量的實驗後,我發現我的問題的答案

var app = angular.module('app', ['ui.select', 'ngSanitize']); 

app.controller("myCtrl", function() { 
vm = this; 

vm.funcAsync = function(query) { 

    if (query === null || query === ""|| query.length<1) { 
     return; 
    } 

vm.isLoaded = false; 
vm.values = [{ 
'key': 22, 
'value': 'Kevin' 
    }, { 
'key': 24, 
'value': 'Fiona' 
    }]; 
    vm.selected; 

}; 

}); 
相關問題