-
Notifications
You must be signed in to change notification settings - Fork 3.4k
md-autocomplete should be able to restrict the selection to one of the predefined choices #1917
Comments
+1 |
I believe this sounds closer to Select functionality, but with an added filter. There has been a lot of discussion over which functionality belongs to which components, and there is a fair amount of gray area between @rschmukler Are there any issues opened for adding filtering to select? |
@robertmesserle A filter to the md-select component should be perfect for this purpose. I'm also missing this feature. Either we could have an option on md-autocomplete to show all the options without typing something or add a filter on md-select. But at the moment we doesn't have a component which displays all its options and provides filtering :) |
Does md-select support incremental loading, say if you have ten thousand So this feature request makes sense even if md-select supported filtering. On 4 April 2015 at 01:07, Julien Goux notifications@github.com wrote:
. |
I filed #2327 to support filtering in mdSelect. |
Filtering and multiple selection are needed in mdSelect via #2327. As @kartGoogle mentioned, it may be possible to implement this request for mdAutocomplete in custom JavaScript validators for many apps out there. It seems like mdAutocomplete already has the list of |
+1 |
2 similar comments
+1 |
+1 |
While this is implemented, for validation purposes I have solved this by using a hidden input attached to the actual model variable, then I set this hidden input as <input type="hidden" ng-model="vm.actualModel" required/>
<md-autocomplete
md-search-text="vm.query"
md-selected-item-change="vm.onSelectedItem(item)"
md-items="item in vm.filterItems(vm.query)">
<!-- -->
</md-autocomplete> In the code above, both |
The autocomplete component should have a mode where it doesn't accept arbitrary input. It forces the user to pick one of the predefined options, like a HTML select. But with the convenience of filtering, say if you have 200 items to pick from.
Example use case: a country chooser. I may prefer to type "Ind" to select "India", rather than going through a list of some 200 country names, but arbitrary input is not acceptable.
This can further be combined with a notion of optional, to have cases like:
Feel free to close this bug if you think this doesn't belong in autocomplete, and clients should do validation themselves in JS.
The text was updated successfully, but these errors were encountered: