Angularjs ui选择鼠标选择不适用于标记标签=false
在角度ui选择中使用Angularjs ui选择鼠标选择不适用于标记标签=false,angularjs,ui-select,Angularjs,Ui Select,在角度ui选择中使用tagging label='false'时,无法通过鼠标单击进行选择。我使用angular ui select-0.13.2、0.14.1和最新版本0.14.9进行了测试。我的要求是,我可以通过键盘像文本框一样输入任何值,我可以用鼠标从下拉列表中选择任何现有选项 <ui-select tagging="newTag" tagging-label="false" ng-model="selectedCountry" theme="bootstrap" style="w
tagging label='false'
时,无法通过鼠标单击进行选择。我使用angular ui select-0.13.2、0.14.1和最新版本0.14.9进行了测试。我的要求是,我可以通过键盘像文本框一样输入任何值,我可以用鼠标从下拉列表中选择任何现有选项
<ui-select tagging="newTag" tagging-label="false" ng-model="selectedCountry" theme="bootstrap" style="width: 300px;" title="Choose a country">
<ui-select-match placeholder="Select country...">{{$select.selected}}</ui-select-match>
<ui-select-choices repeat="country in countries | filter:$select.search">
{{country}}
</ui-select-choices>
</ui-select>
{{$select.selected}
{{国家}
这是Plnkr-我认为问题出在
tagging=“newTag”
属性中,它需要定义一个$scope.newTag()
函数(但在控制器中缺少)
其工作原理如下所示更改代码:
<ui-select ng-model="model.selectedCountry" tagging-label="false" theme="bootstrap" ng-disabled="disabled" style="width: 300px;" title="Choose a country">
<ui-select-match placeholder="Select country...">{{$select.selected}}</ui-select-match>
<ui-select-choices repeat="country in countries | filter:$select.search">
{{country}}
</ui-select-choices>
</ui-select>
plnkr更新:
我认为问题出在
tagging=“newTag”
属性中,该属性需要定义一个$scope.newTag()
函数(但您的控制器中缺少该函数)
其工作原理如下所示更改代码:
<ui-select ng-model="model.selectedCountry" tagging-label="false" theme="bootstrap" ng-disabled="disabled" style="width: 300px;" title="Choose a country">
<ui-select-match placeholder="Select country...">{{$select.selected}}</ui-select-match>
<ui-select-choices repeat="country in countries | filter:$select.search">
{{country}}
</ui-select-choices>
</ui-select>
plnkr更新:
您的版本启用鼠标单击,但随后禁用标记。也就是说,无法再向列表中添加新值。只有我可以通过键盘输入值并通过键盘箭头选择值,但仍然无法使用鼠标更改选择。很抱歉,我修改了Plunker以通过@sclassen实现指示,但它不起作用。现在我恢复了以前的版本,它可以工作,但没有addTag。我怀疑
tagging
不能正确处理由简单字符串而不是对象组成的choices数组。在ui select docs中,我只看到了以对象作为选择项的示例。但是,我看到文档()中的Plunker也不能正常工作(ref)@beaver对不起……我需要标记为='newTag'。我的要求是,我可以像文本框一样通过键盘输入任何值,并且我可以通过鼠标单击从下拉列表中选择任何现有选项。我更新了原来的问题。请参见此-您的版本启用鼠标单击,但随后禁用标记。也就是说,无法再向列表中添加新值。只有我可以通过键盘输入值并通过键盘箭头选择值,但仍然无法使用鼠标更改选择。很抱歉,我修改了Plunker以通过@sclassen实现指示,但它不起作用。现在我恢复了以前的版本,它可以工作,但没有addTag。我怀疑tagging
不能正确处理由简单字符串而不是对象组成的choices数组。在ui select docs中,我只看到了以对象作为选择项的示例。但是,我看到文档()中的Plunker也不能正常工作(ref)@beaver对不起……我需要标记为='newTag'。我的要求是,我可以像文本框一样通过键盘输入任何值,并且我可以通过鼠标单击从下拉列表中选择任何现有选项。我更新了原来的问题。看到这个了吗-