Skip to main content

uppercase

Validate that a string is entirely uppercase (no lowercase characters anywhere).

Signature

NguardValidators.String.uppercase: ValidatorFn

A parameterless validator — used directly without invocation.

Reactive forms

import { FormControl } from '@angular/forms';
import { NguardValidators } from 'ng-nguard';

const code = new FormControl('', [NguardValidators.String.uppercase]);

Template-driven forms

<input ngModel name="code" nguardUppercase />

Error key

{ uppercase: true }

Notes

  • The check uses value.toUpperCase() === value — any case-insensitive character (digits, symbols) trivially passes.
  • Empty strings fail (length must be greater than zero).
  • null, undefined, non-string inputs all fail.

See also