You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some more advanced use-cases a typeahead might display more options than are supposed to be selected by a user. An example of this can be seen on https://www.kayak.com/flights where in addition to flight proposal there is the "Sign up to access recent searches anywhere". It looks like a "normal" option (is displayed in a dropdown, can be iterated over with keyboard etc.) except that it can't be selected and shouldn't result in model binding.
We could easily cover this use-case by giving people ability to veto selection in the selectItem callback (ex. by interpreting false as a return value or changing event we pass to the selectItem function).
The text was updated successfully, but these errors were encountered:
This is similar to typeahead-should-select from http://angular-ui.github.io/bootstrap/#/typeahead. At the same time I don't see why we should be separating typeahead-on-select and typeahead-should-select as we can combine them into one.
My proposal: check the return value from the selectItem callback (if one was defined). If the return value is equal to false then don't write back to the model value.
Bah, we can't do this... I'm not thinking straight - we are just emitting through EventEmitter so I don't think we can expect a return value. What we would have to do is to provide an event object and have a preventDefault() method on this event object.
In some more advanced use-cases a typeahead might display more options than are supposed to be selected by a user. An example of this can be seen on https://www.kayak.com/flights where in addition to flight proposal there is the "Sign up to access recent searches anywhere". It looks like a "normal" option (is displayed in a dropdown, can be iterated over with keyboard etc.) except that it can't be selected and shouldn't result in model binding.
We could easily cover this use-case by giving people ability to veto selection in the
selectItem
callback (ex. by interpretingfalse
as a return value or changing event we pass to theselectItem
function).The text was updated successfully, but these errors were encountered: