@knora/action
Version:
Knora ui module: action
24 lines (23 loc) • 807 B
TypeScript
import { PipeTransform } from '@angular/core';
/**
* This pipe can be used to shorten long text by a defined length.
*
* In markup:
*
* {{ str | kuiTruncate:['24'] }}
*
* or
*
* {{ str | kuiTruncate:['24', '...'] }}
*
*
* The first parameter defines the length where to truncate the string.
* Second optional parameter defines the characters to append to the shortened string. Default is '...'.
*
* The advantage of this pipe over the default Angular slice pipe is the simplicity of adding additional characters at the end of the shortened string.
* The same construct with Angular slice pipe looks as follow: `{{ (str.length>24)? (str | slice:0:24)+'...':(str) }}`.
*
*/
export declare class TruncatePipe implements PipeTransform {
transform(value: string, args: string[]): string;
}