Closed hollsteinm closed 8 years ago
So I was looking at the source.
The md-autcomplete
only auto
selects, if there is only one possible match.
So since there are many matches, if you just enter A
, the autocomplete will not detect that as an exact match. (See in source)
It's actually not a bug and it seems to work as expected in my opinion.
@hollsteinm I would be very happy to discuss about that.
Also I will talk to the Team today and try to re-validate the logic.
Hi, thank you for pointing that out to me. (Guess I didn't read it as closely as I thought). The only problem is that the use case involved selecting a range of numbers that were used as identification. The values were a range of one to three digit numbers. Of course these identifiers had to be filtered out so I could not just do a range, and thus were queried from the database. I think the biggest issue is that if the mdAutcomplete contained a value and 'Enter' was pressed to complete the action, mdAutocomplete would not submit the value in the text field.
Hi, I actually updated this behaviour in the code pen. Type in "A" and hit Enter. It will notify null, rather than the value in the field. http://codepen.io/anon/pen/zBZYOb. Would you like me to update the bug to reflect this issue or write a new one?
Actually I don't think that's also an issue, since it's the browsers default behavior to submit the form on enter (when focus is on the input)
If you select your choice with the Arrow Keys and then press Enter, it select the value as expected.
@DevVersion Probably considered an enhancement, but what about the idea of autoselect on focus loss + match?
Suppose we have directions: N, NW, NE. Currently: user types N and tabs off the field -- no item is selected. Folks who do data entry might appreciate a feature where we auto select when focus is lost if there is a match (saving 2+ keystrokes to filter down and press enter.) -- user types N, tabs off -- N item is selected.
@mckenzielong Can you file this as an extra issue, so I can discuss it with the team?
Closing this issue for now, because it's actually not a bug, just some wrong understanding.
FYI: About discussing with the team, this will be not possible, because we only support exact matches here.
@DevVersion The only thing is, "A" is technically an exact match. So shouldn't the statement be "An exact match if it is the only option available".
What I am getting at is that the documentation should be updated to be more clear about this case. Hence, why it was a bug (or at least misunderstood).
@hollsteinm Seems to be reasonable request to update the docs. Thanks.
Actual behavior:
CodePen or Steps to reproduce the issue: *
Angular Versions: *
Additional Information:
Shortcut to create a new CodePen Demo. Note:
*
indicates required information. Without this information, your issue may be auto-closed.