ngx-chips
ngx-chips copied to clipboard
Failed validation clears formValue
PLEASE MAKE SURE THAT:
- you searched similar issues online (9/10 issues in this repo are solved by googling, so please...do it)
- you provide an online demo I can see without having to replicate your environment
- you help me by debugging your issue, and if you can't, do go on filling out this form
I'm submitting a ... (check one with "x")
[ ] bug report => search github for a similar issue or PR before submitting
[x] support request/question
Notice: feature requests will be ignored, submit a PR if you'd like
Current behavior
When validation fails the input field is always cleared. This is undesirable if the validation failed by a typo of a user, resulting in the user to have re-type the complete input again.
Expected behavior
An option to keep the input value when validation fails.
I have implemented this behaviour for myself, but as I am very new to Angular, I am not confident to ask for a pull request, but so for now, I good to go.
Minimal reproduction of the problem with instructions (if applicable)
<tag-input [(ngModel)]='email_to' [trimTags]="true" [separatorKeyCodes]="[13, 188, 186]" [addOnBlur]="true" [ripple]="false" [modelAsStrings] = "true" [validators]="validators"> </ tag-input>
validators = [Validators.required, Validators.pattern('^\w+([\.-]?\w+)@\w+([\.-]?\w+)(\.\w{2,3})+$')];
What do you use to build your app?. Please specify the version
angular-cli 6.0.8
Angular version:
6.0.4
ngx-chips version:
2.0.0-beta.0
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
all
I agree. It would be great to keep the value when the validation error fails
This line clears value on submit then it fires validation. So i guess you can do chages in module and publish own npm plugin. I did same but i have so many changes also that will not meet your requirements so better you do it for your own.
@lagopus1990 @hupptechnologies can you please share the workaround for that issue?