Nikhil Kulkarni
Nikhil Kulkarni

Reputation: 13

Add a separator in md-autocomplete list

I have an autocomplete list which is composed of two varieties of inputs - Airports and Resorts. I want to add separator text delineating each set of Autocomplete options. Like this Delienated options

However, all I have been able to manage to do is add the 'Separator' labels as items to the options list. Like This: 'Separator' labels added as items to the options list

The problem is

  1. There is no way I can prevent users from selecting the Separator fields as actual inputs
  2. The solution looks very ugly

Is there any other way to create 'Separator Labels' in md-autocomplete? Or any way to at least solve the above two problems highlighted?

Upvotes: 1

Views: 529

Answers (1)

Vlad
Vlad

Reputation: 256

md-autocomplete hasn't this feature. But you can emulate autocomplete with md-select

<md-select ng-model="destination" multiple> <md-optgroup label="Airpot"> <md-option ng-value="destination.name" ng-repeat="airport in destinations | filter: {category: 'airport' }">{{airport.name}}</md-option> </md-optgroup> </md-select>

<md-optgroup> is the thing which allow to create not selectable item (headers of categories)

Upvotes: 1

Related Questions