PipeAdded in v15.6Optional

wrInitials

Up to two initials of a name, one grapheme each.

Installation

Import the class. This entry point has no stylesheet.

import { Component } from '@angular/core';
import { WrInitials } from 'ngwr/pipes';

@Component({ imports: [WrInitials] })
export class MyComponent {}

Basic usage

The first two words give one initial each, upper-cased in LOCALE_ID. The rules are wrInitials() in ngwr/utils.

{{ 'Roman Khegay' | wrInitials }}   <!-- "RK" -->
{{ 'Madonna' | wrInitials }}        <!-- "M"  -->
{{ '王小明' | wrInitials }}          <!-- "王" -->
NameInitials
Roman KhegayRK
ada lovelaceAL
MadonnaM
Хегай РоманХР
王小明王
محمد عليمع
👩🏽‍🚀 Valentina👩🏽‍🚀V

Playground

AK

{{ name | wrInitials }}

Customize

Name

API

NameDescriptionTypeDefault
wrInitialsUp to two initials of a name, one grapheme each, upper-cased in LOCALE_ID. wrInitials() from ngwr/utils with the app locale.(value: string | null | undefined) => string-

See also