Skip to main content
cngx-src documentation

withCurrency

Functionforms/input

projects/forms/input/currency.feature.ts

Description#

Configures CngxNumericInput to format its value with a currency's grouping and standard fraction digits (USD -> 2, JPY -> 0) - the currency code drives the number; the symbol is never baked into the editable value. Render the symbol with a CngxPrefix / CngxSuffix affix instead, so a screen reader hears the field label rather than "dollar sign" and the editable text stays a plain number (Pillar 3: configuration over a new organism).

provideInputConfig(withCurrency({ code: 'CHF', locale: 'de-CH' }));
<span class="row">
  <span cngxPrefix>CHF</span>
  <input cngxInput cngxNumericInput [field]="f.price" />
</span>

Signature#

withCurrency(options: CurrencyOptions)

Parameters#

@paramoptionsCurrencyOptions

Returns#

InputConfigFeature