Skip to content

API Reference


API Reference / @dasch-ng/utils / media/src / AspectRatioPipe

Class: AspectRatioPipe ​

Defined in: libs/ng/utils/media/src/lib/media-pipes.ts:122

Formats an aspect ratio as w:h. Accepts 16x9, 16:9, 1_85 / 1.85 (meaning :1) or a number. A decimal ratio is shown with two fraction digits.

Example ​

html
{{ '16x9' | aspectRatio }}          <!-- 16:9 -->
{{ '1_85' | aspectRatio }}          <!-- 1.85:1 -->
{{ 1920 / 1080 | aspectRatio }}     <!-- 1.78:1 -->
{{ '2.39' | aspectRatio : 'de-DE' }} <!-- 2,39:1 -->

Extends ​

  • LocalePipe

Implements ​

  • PipeTransform

Constructors ​

Constructor ​

new AspectRatioPipe(): AspectRatioPipe

Returns ​

AspectRatioPipe

Inherited from ​

LocalePipe.constructor

Properties ​

localeId ​

protected readonly localeId: string

Defined in: libs/ng/utils/media/src/lib/media-pipes.ts:4

Inherited from ​

LocalePipe.localeId

Methods ​

format() ​

protected format(value, maximumFractionDigits, locale?): string

Defined in: libs/ng/utils/media/src/lib/media-pipes.ts:6

Parameters ​

value ​

number

maximumFractionDigits ​

number

locale? ​

string

Returns ​

string

Inherited from ​

LocalePipe.format


transform() ​

transform(value, locale?): string

Defined in: libs/ng/utils/media/src/lib/media-pipes.ts:123

Parameters ​

value ​

string | number | null | undefined

locale? ​

string

Returns ​

string

Implementation of ​

PipeTransform.transform

Released under the MIT License.