Skip to main content
Version: 0.9.0

lowercase

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

Signature​

NguardValidators.String.lowercase: ValidatorFn

A parameterless validator — used directly without invocation.

Reactive forms​

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

const slug = new FormControl('', [NguardValidators.String.lowercase]);

Template-driven forms​

<input ngModel name="slug" nguardLowercase />

Error key​

{ lowercase: true }

Notes​

  • The check uses value.toLowerCase() === 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​

  • uppercase — symmetric counterpart
  • slug — stricter: lowercase alphanumeric with dashes