Gbuomprisco / ngx-chips

Tag Input component for Angular
MIT License
899 stars 359 forks source link

Custom validator errorMessages #980

Open winchester1979 opened 3 years ago

winchester1979 commented 3 years ago

PLEASE MAKE SURE THAT:

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

Hello and thanks for your great library! I'va a just question about the usage. I've implemented a custom validator I would like to use for validating tags value. I put it into validators array and everything works as expected. The validation function is called and if it will pass, the tag is added. My validator return null if validation pass and an object with the error name and the error message if it fails. This is an example of the object returned: {'tagValidatorError': 'My custom validation message'}

Expected behavior

My question is: Because my custom validator has some detailed informations about the validating failure, is it possible to show as error message the message generated by the validator instead of another message defined into errorMessages mapping array?

Thanks in advance for your availability!

Minimal reproduction of the problem with instructions (if applicable)

What do you use to build your app?. Please specify the version

Angular version:

11.0.0

ngx-chips version:

2.2.2

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