简体   繁体   中英

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

I have a dropdown list and a ui-select . on the basis of dropdown value ui-select values are binding. but if i am directly pasting that specific values into ui-select it is showing as selected. how can we prevent a ui-select from copy paste values?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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