auto-complete icon indicating copy to clipboard operation
auto-complete copied to clipboard

how to clear selection with [accept-user-input]=false

Open crh225 opened this issue 8 years ago • 4 comments

IMPORTANT Please be specific with an example. An issue with no example may be closed.

Steps to reproduce and a minimal demo http://plnkr.co/edit/D7d8uHG9XQfpsV0LuqcG?p=preview

Current behavior step 1: select Asia step2: clear out textbox. step3: create a blur event by clicking outside the textbox step3: notice how it gets repopulated with Asia.

crh225 avatar Oct 25 '17 21:10 crh225

this is separate from https://github.com/ng2-ui/auto-complete/issues/277, as I want to clear the value out completely.

crh225 avatar Oct 25 '17 21:10 crh225

It appears it is related to a combination of [list-formatter]="autocompleListFormatter" and accept-user-input=false

crh225 avatar Oct 25 '17 21:10 crh225

it seems to be related to this bit of code: if (_this.inputEl && hasRevertValue && _this.acceptUserInput === false && currentItem === null) { _this.selectNewValue(_this.revertValue); } else if (_this.inputEl && _this.acceptUserInput === true && typeof currentItem === "undefined" && event && event.target.value) { _this.enterNewText(event.target.value); }

crh225 avatar Oct 25 '17 21:10 crh225

I think you need to use select-on-blur

almothafar avatar Mar 27 '18 11:03 almothafar