我写了额外的指令 ui-combobox 并添加了一些配置
<ui-select
ng-model="ctrl.person.selected" theme="select2"
reset-search-input='false'
ui-combobox="email"
style="min-width: 300px" >
<ui-select-match placeholder="...">
{{ctrl.person.selected}}
</ui-select-match>
<ui-select-choices repeat="person.email as person in ctrl.people | propsFilter: {name: $select.search, age: $select.search}">
<div ng-bind-html="person.name | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
app.directive('uiCombobox', function() {
return {
require: 'uiSelect',
link: function(s, e, a, uiSelect) {
s.$watch(function() {
return uiSelect.search
},function() {
if(!uiSelect.search) return;
console.log(uiSelect.search);
var obj = {};
obj[a.uiSel] = uiSelect.search;
s.$broadcast('uis:select', obj);
});
}
}
})