File

core/common/number.pipe.ts

Description

Formats a value according to digit options and locale rules. Extends the behavior of Angular's number pipe by providing an option to define if a truncated value should be rounded up or down (with the number pipe the value will be rounded using the "to-nearest" method).

Example :
<span>{{ 3.45612 | c8yNumber: 'ceil':'1.1-3' }}</span> <!-- 3.457 -->
<span>{{ 3.46 | c8yNumber: 'ceil':'1.3-3' }}</span> <!-- 3.460 -->
<span>{{ 3.45685 | c8yNumber: 'floor':'1.1-3' }}</span> <!-- 3.456 -->

Metadata

Methods

transform
transform(value: number | string, round: "ceil" | "floor" | null | undefined, digitsInfo?: string, locale?: string)
Parameters :
Name Type Optional
value number | string No
round "ceil" | "floor" | null | undefined No
digitsInfo string Yes
locale string Yes
Returns : string | null
transform
transform(value: null | undefined, round: "ceil" | "floor" | null | undefined, digitsInfo?: string, locale?: string)
Parameters :
Name Type Optional
value null | undefined No
round "ceil" | "floor" | null | undefined No
digitsInfo string Yes
locale string Yes
transform
transform(value: number | string | null | undefined, round: "ceil" | "floor" | null | undefined, digitsInfo?: string, locale?: string)
Parameters :
Name Type Optional Description
value number | string | null | undefined No

The value to be formatted.

round "ceil" | "floor" | null | undefined No

When the value needs to be truncated defines if it will be rounded up (='ceil') or down (='floor')

digitsInfo string Yes

Sets digit and decimal representation.

locale string Yes

Specifies what locale format rules to use.

Returns : string

results matching ""

    No results matching ""