Interface

CustomValidatorConfig

@ng-forge/dynamic-forms

Custom validator configuration using Angular's public FieldContext API Returns ValidationError | ValidationError[] | null synchronously

Supports two patterns: 1. Function-based: { type: 'custom', functionName: 'myValidator' } 2. Expression-based: { type: 'custom', expression: 'fieldValue === formValue.password', kind: 'passwordMismatch' }

Signature

interface CustomValidatorConfig
  extends BaseValidatorConfig

Properties

NameTypeDescription
type "custom"Validator type identifier
functionName ?stringName of registered validator function (function-based pattern)
params ?Record<string, unknown>Optional parameters to pass to validator function
expression ?stringJavaScript expression to evaluate (expression-based pattern)
kind ?stringError kind for expression-based validators - links to validationMessages
errorParams ?Record<string, string>

Parameters to include in error object for message interpolation (expression-based pattern) Map of parameter names to expressions that will be evaluated in the same context as the validation expression