gpt4 book ai didi

javascript - 如何不允许在 AngularJS 的 ui-select 中复制粘贴值

转载 作者:数据小太阳 更新时间:2023-10-29 05:37:45 25 4
gpt4 key购买 nike

我有一个下拉列表和一个ui-select。基于下拉值 ui-select 值是绑定(bind)的。但如果我直接将该特定值粘贴到 ui-select 中,它就会显示为选中状态。我们如何防止 ui-select 复制粘贴值?

示例如下所示。

选择查询
                    <div class="dropdown-Finding">
<ui-select class="form-control dropdown-reviwerFinding-select" id="searchBarArea" onkeypress="return false;" multiple tagging tagging-label="false" ng-model="QiReviewerFindingType.selectedItems" theme="bootstrap">
<ui-select-match placeholder="Select Reviewer Findings">{{$item.ShortDescription}}</ui-select-match>
<ui-select-choices repeat="qiQueryFinding in qiQueryFindings | filter:$select.search">
{{qiQueryFinding.ShortDescription}}
</ui-select-choices>
</ui-select>
<span class="carat" open-menu-by-click="searchBarArea"></span>
</div>

最佳答案

http://plnkr.co/edit/BVaXpviCACi5sd3aw9oX?p=preview

使用这些代码。

<ui-select ng-model="ctrl.person.selected" theme="select2" on-select="ctrl.onSelectCallback($item, $model)" ng-disabled="ctrl.disabled" style="min-width: 300px;" title="Choose a person">
<ui-select-match placeholder="Select a person in the list or search his name/age...">{{$select.selected.name}}</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>
<small>
email: {{person.email}}
age: <span ng-bind-html="''+person.age | highlight: $select.search"></span>
</small>
</ui-select-choices>

我试图找出确切的区别,但我做不到。但上面的示例可能会对您有所帮助。

关于javascript - 如何不允许在 AngularJS 的 ui-select 中复制粘贴值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40375764/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com