Pipe

wrTruncate

Clamp string length with optional ellipsis.

Import

import { WrTruncate } from 'ngwr/pipes';

@Component({ imports: [WrTruncate] })
export class MyComponent { /* ... */ }

Basic usage

Strings shorter than the limit pass through untouched.

{{ longText | wrTruncate: 24 }}  <!-- "Lorem ipsum dolor sit a…" -->
Lorem ipsum dolor sit am…

Custom ellipsis

Third argument replaces the default .

{{ longText | wrTruncate: 24 : ' [more]' }}
Lorem ipsum dolor sit am [more]

Playground

Lorem ipsum dolor sit am…

{{ text | wrTruncate: 24 : '…' }}

Customize

Text
Length
24
Ellipsis

API

NameDescriptionTypeDefault
wrTruncateClamp string length with optional ellipsis.(value: string | null | undefined, length = 80, ellipsis = '…') => string