[](https://travis-ci.org/anein/angular2-trim-directive) [](https://www.npmjs.com/package/ng2-trim-directive)
npm install ng2-trim-directive>The directive trims whitespaces from the end of an input text value.
Play with the directive here https://anein.github.io/angular2-trim-directive/.
1. Install ng2-trim-directive.
``bash`
npm i ng2-trim-directive
`
or using Yarn
bash`
yarn add ng2-trim-directive
InputTrimModule
2. Import to your Angular module.
`typescript`
import { InputTrimModule } from 'ng2-trim-directive';
@NgModule({
imports: [
...
InputTrimModule,
...
],
...
3. Add the "trim" attribute to a text input or textarea element.
`html`
or with an option: trim value only on the blur event.
`html``
note: if you use the directive with
---
Good luck.