Skip to main content
cngx-src documentation

withZipPatterns

Functionforms/input

projects/forms/input/input-config.ts

Description#

Adds or overrides postal-code mask patterns keyed by country code.

  • Built-in: ~50 countries keyed by ISO 3166-1 alpha-2 (GB, with UK kept as an alias). Countries with no postal-code system (HK, AE, ...) are intentionally absent.
  • A | in a pattern declares alternates picked by input length (the GB entry: A0A 0AA|AA0 0AA|...).
  • Resolved against the lazily-loaded built-in table merged with config.zipPatterns; an unknown region falls back to 00000.
  • Consumer entries merge per key and win on collision.
  • Region comes from zip:<REGION> or LOCALE_ID.
provideInputConfig(withZipPatterns({ NL: '0000 AA' }));
// <input cngxInputMask="zip:NL" />

Signature#

withZipPatterns(patterns: Record)

Parameters#

@parampatternsRecord

Returns#

InputConfigFeature