Skip to content

Latest commit

 

History

History
68 lines (47 loc) · 1.05 KB

README.md

File metadata and controls

68 lines (47 loc) · 1.05 KB

ng2-truncate-toggle

Installation

  1. You can install ng2-truncate-toggle using npm
npm install ng2-truncate-toggle --save

API

Import

import { NgTruncateToggle } from 'ng2-truncate-toggle';

// In your App's module:
imports: [
   NgTruncateToggle
]

Usage

{{ longString | truncate: 20 }}

Truncate with controls

<truncate-text
    [source]="sourceString"
    [max-length]="100"
></truncate-text>

All options for truncate controls

<truncate-text
    [show-less-text]="'Less'"
    [show-more-text]="'More'"
    [source]="sourceString"
    [max-length]="100"
    [elipse]="..."
    [show-controls]="true"
></truncate-text>

Event

<truncate-text
    (onChange)="callback($event)"
></truncate-text>

onChange: Fires when you toggle text with controls.

Thanks for understanding!

License

The MIT License (see the LICENSE file for the full text)