Skip to content

API Reference


API Reference / @dasch-ng/utils / src / TruncateTextPipe

Class: TruncateTextPipe ​

Defined in: libs/ng/utils/src/lib/truncate-text.pipe.ts:14

Shortens text to at most limit characters plus …, cutting at the last space before the limit. If that space lies in the first half, it cuts at the limit instead, so a long first word does not leave almost nothing.

Example ​

html
<p>{{ description | truncateText: 120 }}</p>

Implements ​

  • PipeTransform

Constructors ​

Constructor ​

new TruncateTextPipe(): TruncateTextPipe

Returns ​

TruncateTextPipe

Methods ​

transform() ​

transform(value, limit?): string

Defined in: libs/ng/utils/src/lib/truncate-text.pipe.ts:15

Parameters ​

value ​

string | null | undefined

limit? ​

number = 160

Returns ​

string

Implementation of ​

PipeTransform.transform

Released under the MIT License.