Material: Can you add the ability to disable an option in the md-autocomplete list

Created on 13 Jul 2016  路  8Comments  路  Source: angular/material

I have an autocomplete list, and I want to be able to disable some of the results from the search based on the data. I have managed it by using an item-template containing a div with an ng-click event that stops propagation, but that seems a bit rubbish.

not core won't fix

Most helpful comment

@DevVersion Another use case is a list of products where some should not be selectable because of business rules, but you don't want to hide it, you just want to show users that the option is there but not selectable.

All 8 comments

@apils I can't see the point of disabling an item in the autocomplete dropdown?

The autocomplete should only show options that are based on that query (and are apparently valid).

Can you give more details about your desired use-case?

This is not supported in the Material Design specifications.

@DevVersion A use case for this is when you want to group items in the list like this: https://github.com/angular/material/issues/7417 . The items that label the group should not be clickable.

@DevVersion Another use case is a list of products where some should not be selectable because of business rules, but you don't want to hide it, you just want to show users that the option is there but not selectable.

@andrehil. true

How is it going?

I would also like this feature.

Please use $mdPanel to implement this custom behavior in your app. This isn't part of the Material Design specifications, so we won't be adding this to AngularJS Material core.

Was this page helpful?
0 / 5 - 0 ratings