• Overview
@angular/common

getCurrencySymbol

function
deprecatedsince v18

Retrieves the currency symbol for a given currency code.

API

function getCurrencySymbol(
  code: string,
  format: 'wide' | 'narrow',
  locale?: string,
): string;

getCurrencySymbol

string

Retrieves the currency symbol for a given currency code.

For example, for the default en-US locale, the code USD can be represented by the narrow symbol $ or the wide symbol US$.

@deprecated

Angular recommends relying on the Intl API for i18n. You can use Intl.NumberFormat().formatToParts() to extract the currency symbol. For example: Intl.NumberFormat('en', {style:'currency', currency: 'USD'}).formatToParts().find(part => part.type === 'currency').value returns $ for USD currency code in the en locale. Note: US$ is a currency symbol for the en-ca locale but not the en-us locale.

@paramcodestring

The currency code.

@paramformat"wide" | "narrow"

The format, wide or narrow.

@paramlocalestring

A locale code for the locale format rules to use.

@returnsstring

Description

Retrieves the currency symbol for a given currency code.

For example, for the default en-US locale, the code USD can be represented by the narrow symbol $ or the wide symbol US$.

Jump to details