ng2-ui / auto-complete

Angular Auto Complete component and directive
http://ng2-ui.github.io/auto-complete/
MIT License
279 stars 124 forks source link

Hitting the enter key after focusing on the input and before entering any characters will display 'undefined'. #252

Closed jwoo896 closed 6 years ago

jwoo896 commented 7 years ago

Everything works as it should really. The text in the input box becomes "undefined" when I hit enter without typing anything in. This specifically only happens when I hit enter right after focusing on the input box and before typing anything in at all. If I type something in first and then clear out what I typed in and hit enter on an empty string, nothing happens (which is what I want). screen shot 2017-08-10 at 3 21 00 pm

allenhwkim commented 7 years ago

You can auto select the first item by having [auto-select-first-item]="true"

@lemarsu this is introduced after the recent merge. Can you also debug why it is undefined without auto-select-first-item?

jwoo896 commented 7 years ago

I actually don't want it to. I want it to recognize that nothing was entered, and then do nothing. I know that's a very nit-picky thing.. If it's more trouble than its worth I'll just leave it hahaha

lemarsu commented 7 years ago

When the Input auto-select-first-item is set to false (or not given), the behaviour is what @evasquez26 introduced with PR #240. When the auto-select-first-item is set to true, the behaviour should be the same as before PR #240.

Maybe @evasquez26 could have an idea ?

ghost commented 7 years ago

Yes I think I know what might be happening with the undefined value. I'll submit a PR later

allenhwkim commented 7 years ago

@evasquez26 thank you very much.

jwoo896 commented 7 years ago

Thank you so much!

On Fri, Aug 11, 2017 at 12:11 PM, Allen Kim notifications@github.com wrote:

@evasquez26 https://github.com/evasquez26 thank you very much.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ng2-ui/auto-complete/issues/252#issuecomment-321854820, or mute the thread https://github.com/notifications/unsubscribe-auth/AOoDsZqGT4q01tGQn2t9pfSpwMIPhrXmks5sXH1KgaJpZM4Oz3co .