角度版本:AngularJS v1.3.6 http://github.com/angular-ui/ui-select:版本:0.8.3
var p1 = {name:'Ramesh',email:'[email protected]',年龄:99};
$scope.people = [
{ name: 'Amalie', email: '[email protected]', age: 12 },
{ name: 'Wladimir', email: '[email protected]', age: 30 },
{ name: 'Samantha', email: '[email protected]', age: 31 },
{ name: 'Estefanía', email: 'estefaní[email protected]', age: 16 },
{ name: 'Natasha', email: '[email protected]', age: 54 },
{ name: 'Adrian', email: '[email protected]', age: 21 },
p1
];
$scope.people.selected = p1 ;
HTML:
<ui-select class="full-width-select select" ng-model="people.selected" theme="select2">
<ui-select-match allow-clear="false">{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="person in people | filter:$select.search">
<div ng-bind-html="person.name | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
问题是当以编程方式选择p1时
在ui-select下拉列表中未突出显示p1对象。
输出是: