Skip to content

API Reference


API Reference / @dasch-ng/utils / intl/src / IntlNumberPipe

Class: IntlNumberPipe ​

Defined in: libs/ng/utils/intl/src/lib/intl-number.pipe.ts:17

Formats a number with Intl.NumberFormat: grouping, decimals, percent, compact notation or units. No locale data registration needed.

Example ​

html
{{ 1234.5 | intlNumber }}                                         <!-- 1,234.5 -->
{{ 0.256 | intlNumber: { style: 'percent' } }}                    <!-- 26% -->
{{ 1500000 | intlNumber: { notation: 'compact' } }}               <!-- 1.5M -->
{{ 12 | intlNumber: { style: 'unit', unit: 'kilometer-per-hour' } }} <!-- 12 km/h -->

Extends ​

  • IntlPipeBase

Implements ​

  • PipeTransform

Constructors ​

Constructor ​

new IntlNumberPipe(): IntlNumberPipe

Returns ​

IntlNumberPipe

Inherited from ​

IntlPipeBase.constructor

Methods ​

locale() ​

protected locale(locale?): string

Defined in: libs/ng/utils/intl/src/lib/formatter-cache.ts:29

Parameters ​

locale? ​

string

Returns ​

string

Inherited from ​

IntlPipeBase.locale


transform() ​

transform(value, options?, locale?): string | null

Defined in: libs/ng/utils/intl/src/lib/intl-number.pipe.ts:18

Parameters ​

value ​

number | bigint | null | undefined

options? ​

NumberFormatOptions

locale? ​

string

Returns ​

string | null

Implementation of ​

PipeTransform.transform

Released under the MIT License.