min
Validate that a numeric value is greater than or equal to a literal minimum.
Signature
NguardValidators.Number.min(minVal: number): ValidatorFn
| Parameter | Type | Description |
|---|---|---|
minVal | number | Inclusive minimum allowed value |
Reactive forms
import { FormControl } from '@angular/forms';
import { NguardValidators } from 'ng-nguard';
const age = new FormControl('', [NguardValidators.Number.min(18)]);
Template-driven forms
<input ngModel name="age" [nguardMin]="18" />
Error key
{ min: true }
Notes
- The check is
>=(inclusive).min(18)accepts18. - Numeric strings work —
'18'passesmin(18). null,undefined, empty string,NaN,Infinityall fail.
See also
max— upper-bound counterpartbetween— both bounds in one validatorgreaterThanOrEqual— same operator but compares against a sibling field instead of a literal