angularjsangular-ui-bootstrapangular-ui-selectangularjs-1.6

Angular ui-select multiple hide selected


Is it possible to hide some SELECTED items in ng-select multiple select?

I create event with multiple users, including myself. I want to keep myself on the list in model but I don't want to display myself in ui-select-match.

I've tried using ng-hide on ui-select-match, but it was unsuccessful.

<ui-select multiple ng-model="event.users" theme="bootstrap">
   <ui-select-match placeholder="Select users...">{$ $item.username $}</ui-select-match>
   <ui-select-choices repeat="user in users">
      <div ng-bind-html="user.username" ng-show="user.id != auth.id"></div>
   </ui-select-choices>
</ui-select>

Solution

  • I don't know how you can hide it, but you can forbide deleting yourself with:

    ui-lock-choice="$item.id == auth.id"
    

    Demo on JSFiddle