minDigits
Validate that an integer has at least N digits.
Signature
NguardValidators.Number.minDigits(n: number): ValidatorFn
| Parameter | Type | Description |
|---|---|---|
n | number | Minimum required digit count |
Reactive forms
import { FormControl } from '@angular/forms';
import { NguardValidators } from 'ng-nguard';
const id = new FormControl('', [NguardValidators.Number.minDigits(4)]);
Template-driven forms
<input ngModel name="id" [nguardMinDigits]="4" />
Error key
{ minDigits: true }
Notes
- The check is
>=(inclusive). - The value must be an integer. Floats fail.
- Sign is excluded from the count.
See also
maxDigits— upper-bound counterpartdigitsBetween— both bounds in one validatordigits— exact digit count