I use Material Design and AngularJS, and I want to display some non-selectable element in my autocomplete.
My autocomplete object, which can be associated with the object the user is working on. Some of these objects are already associated with another object. I want to display them, but make them non-selectable.
Here is my autocomplete in the tpl.html file:
<md-autocomplete
md-no-cache="noCache"
md-selected-item="selectedItem"
md-search-text="searchText"
md-selected-item-change= "controller.selectedItemChange(item)"
md-items="item in controller.searchEntities(searchText)"
md-item-text="item.display"
md-min-length="3"
placeholder="Enter Keyword"
md-input-name="autocompleteEntities">
<md-item-template>
<span ng-show="!item.isLinked"md-highlight-text="searchText" md-highlight-flags="^i">
{{item.display}}
</span>
<span class="linkedEntity" ng-show="item.isLinked"md-highlight-text="searchText" md-highlight-flags="^i">
{{item.display}}
</span>
</md-item-template>
<md-not-found>
No Result For "{{searchText}}".
</md-not-found>
</md-autocomplete>
My autocomplete works and returns to me the object I want.
I already tried to make an element non-selectable with pointer-events: none;, but you can still select it.
How to make an item unselectable?
Any help would be appreciated, thanks in advance.