angularjsui-select2

How to disable remove icon in ui-select2


Is there a way to disable the icons in ui-select2? I am using ui-select2 in angular js, which is like adding tags while posting a question on stackoverflow:

enter image description here

How can I disable remove icon conditionally?


Solution

  • Official website of ui select2

    [Edit 2018-11-12] You could always do a "display: none" on the x span:

    span.select2-selection__choice__remove {
      display: none;
    }
    

    You could also use that to disable click on it with pure JS.

    And there is also a "locked" option: http://select2.github.io/select2/#locked-selections You can then control, per data, which one can't be removed from the selection.