-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Typeahead bug when selecting a "perfect match" from the dropdown #3166
Comments
Seems that we both ran into the same issue, I fixed this by using the "typeahead-on-select" directive and a controller like below: .controller('TypeaheadCtrl', [function ($scope) {
$scope.onSelect = function ($item, $model, $label, formInput) {
formInput.$setValidity('parse', true);
};
}]) and then in the html view, within the typeahead input element i added the following directives:
I believe this is an angular 1.3.x thing, have not tested it yet with angular 1.2.x |
I also ran into this issue, it seems that the parser is not called when the selected value is the same as the one in the input field. |
@zv3 solution ignores the parser totally. Is there a way to call the parser manually ? |
+1 |
The parser shouldn't need to be called if the view value doesn't change. On the surface I don't see a problem with setting the 'parse' validation key as valid when an item is selected, considering that the same thing is done with the 'editable' validation key also |
When typeahead-editable="false" and we select a perfect match from the results list, the $parsers aren't called, which results in the 'parse' error key not being reset. As with the 'editable' key, we should reset this once an item is selected because we know we have a valid model matching the view value. Closes angular-ui#3166
See this plunker
If the input value is exactly the same as one of the items in the dropdown, and you select that item. The input gets an incorrect state (
$invalid = true
).In our case, this prevents the user to submit the form, and it's hard for them to understand why the field is validated as "has error" even though they did nothing wrong.
A "hack" that can be used until this gets fixed would be much appreciated!
The text was updated successfully, but these errors were encountered: