简体   繁体   English

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

[英]How to not allow copy pasted values in ui-select in AngularJS

I have a dropdown list and a ui-select . 我有一个dropdown list和一个ui-select on the basis of dropdown value ui-select values are binding. 在下拉值的基础上, ui-select值具有约束力。 but if i am directly pasting that specific values into ui-select it is showing as selected. 但如果我直接将特定值粘贴到ui-select它将显示为已选中。 how can we prevent a ui-select from copy paste values? 我们如何防止ui-select复制粘贴值?

example is shown below. 示例如下所示。

Select Query 选择查询
  <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 http://plnkr.co/edit/BVaXpviCACi5sd3aw9oX?p=​​preview

Use these kind of code. 使用这些代码。

<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>

I tried to figure out exact difference but I couldn't. 我试图找出确切的差异,但我不能。 But may be above sample will help you. 但可能上面的样本会帮助你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM