1.0.0 • Published 7 years ago

ng2-truncate-toggle v1.0.0

Weekly downloads
8
License
MIT
Repository
github
Last release
7 years ago

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)