Open aditya-sawant-dev opened 1 year ago
[x] Feature Request / Proposal
NG Dynamic Forms Version: `15.0.0` [x] Basic UI [ ] Bootstrap UI [ ] Foundation UI [ ] Ionic UI [ ] Kendo UI [ ] Material [ ] NG Bootstrap [ ] Prime NG
When i am creating custom validator using following code :
export function myCustomValidator(control: AbstractControl): ValidationErrors | null { const hasError = control.value ? (control.value as string).startsWith("abc") : false; return hasError ? {myCustomValidator: true} : null; }
new DynamicInputModel({ id: "myInput", label: "My Input", validators: { myCustomValidator: { name: myCustomValidator.name, args: null } } })
Now in myCustomValidator Method I am unable to do http call. So we must include a feature that allows us to do http call in custom validator.
In above dynamicinputmodel there is customvalidator object which contains "args". What value can we provide in args ?
Thank you.
Hello @aditya-sawant-dev ,
I am pretty sure you need to add this kind of validator to the "asyncValidators" property instead of the "validators" property.
I'm submitting a
I'm using
Description
When i am creating custom validator using following code :
export function myCustomValidator(control: AbstractControl): ValidationErrors | null { const hasError = control.value ? (control.value as string).startsWith("abc") : false; return hasError ? {myCustomValidator: true} : null; }
new DynamicInputModel({ id: "myInput", label: "My Input", validators: { myCustomValidator: { name: myCustomValidator.name, args: null } } })
Now in myCustomValidator Method I am unable to do http call. So we must include a feature that allows us to do http call in custom validator.
In above dynamicinputmodel there is customvalidator object which contains "args". What value can we provide in args ?
Thank you.