typeahead-editable="false"
does angular-strap typeahead has a similar feature as typeahead-editable="false" does in angular-ui boostrap typeahead?
if no, how to implement one?
thanks,
+1 for this one too. If not preventing invalid input (not matched) at least to invalidate it. With support for asynchronous matching of course...
Isn't that sort of like the "selectMode" option? It prevents the user from inputing further if there is no match, but I see that it is not referenced in the docs and doesn't have tests for it. Maybe you can give it a try and see how it works.
selectMode=true does part of the job but it does not invalidate the input.
Adapted from the plunker in the docs: http://plnkr.co/edit/zYL1z5eeMirO2MBsIFqx?p=preview
I've updated the example from the previous plunker with a modified typeahead directive that implements the correct (IMHO) behaviour for selectMode=true:
http://plnkr.co/edit/zPxHvtmfvGeSD6GG3EaK?p=preview
The changes in the direcive:
- setting the view value to delete last character when selectMode=true and no options available applied with scope.$applyAsync() to prevent infinite digest loop
- expose $typeahead.getActiveIndex() to be used in bsTypeAhead
- if selectMode=true bind a function on element blur to either select the active option or set the view model to empty if no option is active
Angular UI typeahead with typeahead-editable="false" does not prevent user from typing. It can only invalidate the model and set it to undefined. See the PR I've submitted to update the description there:
https://github.com/angular-ui/bootstrap/pull/3572/files#diff-0b60ff012eac4dea7d219af42bc78977L27 in https://github.com/angular-ui/bootstrap/pull/3572
+1
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.