ng2-trim-directive
TypeScript icon, indicating that this package has built-in type declarations

2.3.4 • Public • Published

ng2-trim-directive

Build Status npm

The directive trims whitespaces from the end of an input text value.

Demo

Play with the directive here https://anein.github.io/angular2-trim-directive/.

Usage

  1. Install ng2-trim-directive.
  npm i ng2-trim-directive

or using Yarn

  yarn add ng2-trim-directive
  1. Import InputTrimModule to your Angular module.
import { InputTrimModule } from 'ng2-trim-directive';
@NgModule({
  imports: [
    ...
    InputTrimModule,
    ...
  ],
  ...
  1. Add the "trim" attribute to a text input or textarea element.
   <input type="text" trim />
   <textarea ... trim ></textarea>

or with an option: trim value only on the blur event.

   <input type="text" trim="blur" />
   <textarea ... trim="blur" ></textarea>

note: if you use the directive with


Good luck.

Package Sidebar

Install

npm i ng2-trim-directive

Weekly Downloads

1,532

Version

2.3.4

License

MIT

Unpacked Size

20.9 kB

Total Files

17

Last publish

Collaborators

  • aleine