Javascript 在ui选择中未突出显示以编程方式选择的选项

Javascript 在ui选择中未突出显示以编程方式选择的选项,javascript,angularjs,ui-select2,ui-select,Javascript,Angularjs,Ui Select2,Ui Select,角度版本:AngularJS v1.3.6 :版本:0.8.3 变量p1={name:'Ramesh',电子邮件:'Ramesh@email.com,年龄:99} $scope.people = [ { name: 'Amalie', email: 'amalie@email.com', age: 12 }, { name: 'Wladimir', email: 'wladimir@email.com', age: 30 },

角度版本:AngularJS v1.3.6 :版本:0.8.3

变量p1={name:'Ramesh',电子邮件:'Ramesh@email.com,年龄:99}

   $scope.people = [
            { name: 'Amalie',    email: 'amalie@email.com',    age: 12 },
            { name: 'Wladimir',  email: 'wladimir@email.com',  age: 30 },
            { name: 'Samantha',  email: 'samantha@email.com',  age: 31 },
            { name: 'Estefanía', email: 'estefanía@email.com', age: 16 },
            { name: 'Natasha',   email: 'natasha@email.com',   age: 54 },               
            { name: 'Adrian',    email: 'adrian@email.com',    age: 21 },
            p1
        ];

 $scope.people.selected = p1 ;
html

$observe: check if the attribute is undefined

{{$select.selected.name}

这是由于AngularJS1.3.1中的以下更改造成的:

$observe: check if the attribute is undefined
Ui select使用
$observe
重置搜索输入设置默认值

attrs.$observe('resetSearchInput', function() {
  var resetSearchInput = scope.$eval(attrs.resetSearchInput);
  $select.resetSearchInput = resetSearchInput !== undefined ? resetSearchInput : true;
});
但是由于上面提到的更改以及
resetSearchInput
未定义,观察员函数将永远不会执行

要立即解决此问题,请向ui select元素添加以下属性:

reset-search-input="'false'"

演示:

AngularJS版本?试过了,成功了。你能显示你的HTML吗?你能尝试在这里复制它吗:,点击按钮选择Ramesh或选择John,如果你点击选择下拉菜单,下拉菜单中的选项“Ramesh或John”应该会高亮显示这项工作吗?是的,工作正常,但是我建议切换到新的ui选择版本更好,但是即使没有重置搜索输入属性,您的Plunk也可以正常工作?plnkr.co/edit/RlRH7T@waxingsatirical如果单击“选择Ramesh”按钮,然后打开下拉列表,Ramesh不会高亮显示。至少对我来说不是。