Warning using rxwebvalidator mixing async validators

Viewed 84

I'm using library 'rxwebvalidator' from https://www.npmjs.com/package/@rxweb/reactive-form-validators

Everything is working fine, but it showing warning in console. Here is the warning

It looks like you're constructing using a FormControl with both an options argument and an async validators argument. Mixing these arguments will cause your async validators to be dropped. You should either put all your validators in the options object, or in separate validators arguments. For example:

// Using validators arguments fc = new FormControl(42, Validators.required, myAsyncValidator);

// Using AbstractControlOptions fc = new FormControl(42, {validators: Validators.required, asyncValidators: myAV});

// Do NOT mix them: async validators will be dropped! fc = new FormControl(42, {validators: Validators.required}, /* Oops! */ myAsyncValidator);

I just put the model

export class QnaList {
@required()
@minLength({value: 5})
@maxLength({value: 50})
question: string;

@required()
@minLength({value: 10})
@maxLength({value: 100})
answer: string;

}

And initialize it

        let qnaList = new QnaList();
    this.qnaForm = this.fb.formGroup(qnaList, new FormBuilderConfiguration({
        baseAbstractControlOptions: {
            answer: {
                updateOn: 'blur'
            },
        },
    }))

How to remove or suppress this warning? I'm using angular 14 and rxwebvalidator 2.1.7

0 Answers
Related