Open perrosen opened 6 years ago
For now I solved it by binding the input value to the placeholder element. Would be nice with an option for this instead of my little hack :)
Looking at the code I'm not sure where this is being cleared.
You don't find it because I don't clear the input. It is a side effect of *ngIf
directive. The input removes and puts back by *ngIf
.
To solve your issue I think to change the *ngIf
with [hidden]
and add some logic for controlling to clear/NOclear the input.
Accepted as an enhancement to a next release.
Yeah noticed its the actual input element being removed on blur which is why the text disappears.
Think the logic (at least for my use case) is that if input has content and nothing is selected then on blur the input shouldn't be hidden at all. A behaviour like this should maybe be controlled via a setting as to not break others implementation. But this would be super useful I think since you could make use of the component as an input field combined with a select 👍
Also, thanks for the quick response. By far the best custom select for angular2 I have come across so far. Most are half broken or wrappers of select2 with jquery dependencies!
Is this enhancement included in the new release?
Is there a way to prevent input text from being cleared on blur on a single select when user blurs without selecting an option? I have a case where I the search is being used to fetch results from the backend but the user should still have the possibility of manually adding the text using a button outside of component. Currently the blur/close seems to clear the input value.
Looking at the code I'm not sure where this is being cleared. Saw in the last release you added an option to clear the text for multiple select. Maybe another option can be set here to prevent clearing of input on single selects?