import { Component } from '@angular/core';
import { WrTruncate } from 'ngwr/pipes';
@Component({ imports: [WrTruncate] })
export class MyComponent {}wrTruncate
Shorten a string and end it with an ellipsis.
Installation
Import the class. This entry point has no stylesheet.
Basic usage
A shorter string passes through unchanged.
{{ longText | wrTruncate: 24 }} <!-- "Lorem ipsum dolor sit am…" -->Custom ellipsis
The third argument replaces … and is added after the cut.
{{ longText | wrTruncate: 24 : ' [more]' }}Playground
Lorem ipsum dolor sit am…
{{ text | wrTruncate: 24 : '…' }}Customize
Text
Length 24
Ellipsis
API
| Name | Description | Type | Default |
|---|---|---|---|
wrTruncate | Cuts a string to length and appends ellipsis. | (value: string | null | undefined, length = 80, ellipsis = '…') => string | — |