- You can install ng2-truncate-toggle using npm
npm install ng2-truncate-toggle --save
import { NgTruncateToggle } from 'ng2-truncate-toggle';
// In your App's module:
imports: [
NgTruncateToggle
]
{{ longString | truncate: 20 }}
<truncate-text
[source]="sourceString"
[max-length]="100"
></truncate-text>
<truncate-text
[show-less-text]="'Less'"
[show-more-text]="'More'"
[source]="sourceString"
[max-length]="100"
[elipse]="..."
[show-controls]="true"
></truncate-text>
<truncate-text
(onChange)="callback($event)"
></truncate-text>
onChange
: Fires when you toggle text with controls.
Thanks for understanding!
The MIT License (see the LICENSE file for the full text)