Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set input invalid when typeahead-editable is false

I'm using typeahead's UI Bootstrap component and I want to force the selection to validate my form.

Is it possible to configure it to set the input invalid when typeahead-editable is set to false and the user enters a "bad" value or I should write a directive for this (but how)?

like image 418
Julien Meyer Avatar asked Aug 08 '13 14:08

Julien Meyer


1 Answers

The typeahead directive from http://angular-ui.github.io/bootstrap/ has already support for limiting inputs to matches (in other words, people can bind to model only values available as matches in the typeahead popup). You can do this by simply setting typeahead-editable='false' attribute.

Please note that setting this attribute to false will not prevent people from typing-in invalid values. It will just make sure that a corresponding input is marked as invalid and a provided value is not bound to the model.

like image 117
pkozlowski.opensource Avatar answered Nov 16 '22 07:11

pkozlowski.opensource