max
Binds a validator to the given path that requires the value to be less than or equal to the given maxValue. This function can only be called on number paths. This function can only be called on number paths. In addition to binding a validator, this function adds MAX property to the field.
API
function max< TValue extends number | null, TPathKind extends PathKind = PathKind.Root, >( path: SchemaPath<TValue, 1, TPathKind>, maxValue: number | LogicFn<TValue, number | undefined, TPathKind>, config?: BaseValidatorConfig<TValue, TPathKind> | undefined, ): void;
@parammaxValue
number | LogicFn<TValue, number | undefined, TPathKind>The maximum value, or a LogicFn that returns the maximum value.
@paramconfig
BaseValidatorConfig<TValue, TPathKind> | undefinedOptional, allows providing any of the following options:
-
error: Custom validation error(s) to be used instead of the defaultValidationError.max(maxValue)or a function that receives theFieldContextand returns custom validation error(s).
@returns
void
Super-powered by Google ©2010–2025.
Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.
https://angular.dev/api/forms/signals/max