CustomValidatorConfig
| Extends: | |
Custom validator configuration using Angular's public FieldContext API Returns ValidationError | ValidationError[] | null synchronously
Supports two patterns:
- Function-based: { type: 'custom', functionName: 'myValidator' }
- Expression-based: { type: 'custom', expression: 'fieldValue === formValue.password', kind: 'passwordMismatch' }
Properties
| Name | Type | Description |
|---|---|---|
| errorParams | Record<string, string> | undefined | 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 |
Example usageerrorParams: { minValue: 'formValue.minValue', maxValue: 'formValue.maxValue' } // Allows message template: "Value must be between {{minValue}} and {{maxValue}}" | ||
| expression | string | undefined | JavaScript expression to evaluate (expression-based pattern) |
| functionName | string | undefined | Name of registered validator function (function-based pattern) |
| kind | string | undefined | Error kind for expression-based validators - links to validationMessages |
| params | Record<string, unknown> | undefined | Optional parameters to pass to validator function |
| type | "custom" | Validator type identifier |
| when inherited from | | Conditional logic for when validator applies |