reactive_forms
reactive_forms copied to clipboard
Implement custom AsyncValidator class
Hi, I'm trying to create a async validator class, however I noticed there is no interface for it. I want to take this approach, because I want to use getIt dependency injection of my services into the validator.
Validator<T> only have a sync interface. And returning a ValidatorFunction is also a sync interface.
So I'm only left with the docs and implementing local function. Any ideas?
p.s. Love your reactive forms port by the way!
Hi @morrowyn,
Thanks for using Reactive Forms and for your kind words. As far as I understand about your issue is that you want to create a class that implements an interface like abstract class AsyncValidator. The same way that is implemented the abstract class Validator. Is that what you are suggesting?
Please let me know, and best regards.
Hi @morrowyn,
Could you please clarify for me if is correct the answer in my first comment? I would like to know if is correct my understanding of what you want with this issue?
Best regards
Sorry for the late response. But yes, I would like that have an AsyncValidator abstract class
Hi @morrowyn
The newly released version 15.0.0 brings the validators as classes and an AsyncValidator
class. Now you can inherit from AsyncValidator to implement a custom validator class.
Thanks for the issue and the contribution.