File

projects/congarevenuecloud/ecommerce/src/lib/modules/pricing/pipes/convert.pipe.ts

Description

This pipe is a work in progress.

Core pipe to convert a number into the currency and format specified by the user. By default conversion is done based on the currency ISO code defined in the price list. However, user can also pass the currency ISO code that needs to be accounted for during the currency conversion. Additionally user can pass the display currency symbol and decimal representation of the currency value.

Example:

<!-- Renders $5.55 -->
<span>{{5.55 | convertCurrency | async}}</span>
<!-- Renders €65.23 -->
<span>{{65.23 | convertCurrency: 'EUR' | async}}</span>
<!-- Renders CA$821.36 -->
<span>{{821.36 | convertCurrency: 'CAD': 'symbol' | async}}</span>

Metadata

Methods

transform
transform(value: number, currencyIsoCode: string, display: "code" | "symbol" | "symbol-narrow" | string | boolean, digitsInfo: string)

Defaulted to the currency code defined on price list. Can take values like 'code', 'symbol', 'symbol-narrow', a customized string or boolean. Defaulted to symbol-narrow

Parameters :
Name Type Optional Default value Description
value number No

the number to convert.

currencyIsoCode string No null

a string value representing ISO 4217 currency code. Defaulted to the currency code defined on price list.

display "code" | "symbol" | "symbol-narrow" | string | boolean No 'symbol-narrow'

to display the currency symbol. Can take values like 'code', 'symbol', 'symbol-narrow', a customized string or boolean. Defaulted to symbol-narrow

digitsInfo string No '1.'

string representing decimal representation of currency value.

Returns : any

results matching ""

    No results matching ""