Autocomplete Multiple model become empty string when delete digits #7161
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
I'm submitting a ... (check one with "x")
Plunkr Case (Bug Reports)
https://stackblitz.com/edit/angular-f7xluh
Current behavior
On a multiple autocomplete, If i add some value, and start typing a new on and delete all of my digits (so the input value become an empty string), the model/form control become an empty string
Expected behavior
The model/form control should be the list of value previously selected.
Minimal reproduction of the problem with instructions
Type 'a' and select Afghanistan, type 'b' and select Bahamas, type 'c' and backspace to delete.
What is the motivation / use case for changing the behavior?
It's a problem.
I think the error is on src/app/components/autocomplete/autocomplete.ts on line 333
this code
this.onModelChange(value);
should become
if (!this.multiple) this.onModelChange(value);
otherwise the model of multiple autocomplite become empty string and lose the previous values.
Angular version: 7.0
PrimeNG version: ^7.0.4
Browser: all
Language: all
Node (for AoT issues): 1.6.0
The text was updated successfully, but these errors were encountered: