Skip to main content

min

Validate that a numeric value is greater than or equal to a literal minimum.

Signature

NguardValidators.Number.min(minVal: number): ValidatorFn
ParameterTypeDescription
minValnumberInclusive 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) accepts 18.
  • Numeric strings work — '18' passes min(18).
  • null, undefined, empty string, NaN, Infinity all fail.

See also

  • max — upper-bound counterpart
  • between — both bounds in one validator
  • greaterThanOrEqual — same operator but compares against a sibling field instead of a literal