# ng2-trim-directive

> [![Build Status](https://travis-ci.org/anein/angular2-trim-directive.svg?branch=master)](https://travis-ci.org/anein/angular2-trim-directive) [![npm](https://img.shields.io/npm/v/ng2-trim-directive.svg)](https://www.npmjs.com/package/ng2-trim-directive)

Latest version **2.3.4** (published 2020-04-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install ng2-trim-directive
pnpm add ng2-trim-directive
yarn add ng2-trim-directive
bun add ng2-trim-directive
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.4 |
| Published | 2020-04-14 |
| First published | 2017-08-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 20.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 46 |
| Author | Alexander Ein |
| Maintainers | aleine |
| Keywords | angular, ng2, directive, typescript, trim, javascript |

## Links

- npm: https://www.npmjs.com/package/ng2-trim-directive
- Repository: https://github.com/anein/angular2-trim-directive
- Homepage: https://github.com/anein/angular2-trim-directive#readme
- Issues: https://github.com/anein/angular2-trim-directive/issues
- npm.io page: https://npm.io/package/ng2-trim-directive

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 2.3.4 (latest) — 2020-04-14
- 2.3.3 — 2019-12-06
- 2.3.2 — 2018-12-29
- 2.3.1 — 2018-12-23
- 2.3.0 — 2018-11-20
- 2.2.1 — 2018-11-20
- 2.2.0 — 2018-11-15
- 2.1.7 — 2018-10-19
- 2.1.5 — 2018-06-17
- 2.1.4 — 2018-04-23
- 2.1.3 — 2018-04-23
- 2.1.2 — 2018-01-08
- 2.1.1 — 2018-01-06
- 2.1.0 — 2017-12-22
- 2.0.0 — 2017-10-26
- … 5 more at https://npm.io/package/ng2-trim-directive/versions

## README

# ng2-trim-directive
[![Build Status](https://travis-ci.org/anein/angular2-trim-directive.svg?branch=master)](https://travis-ci.org/anein/angular2-trim-directive)
[![npm](https://img.shields.io/npm/v/ng2-trim-directive.svg)](https://www.npmjs.com/package/ng2-trim-directive)

>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/](https://anein.github.io/angular2-trim-directive/).

## Usage 

1. Install `ng2-trim-directive`.

  ```bash
    npm i ng2-trim-directive
  ```
  
  or using **Yarn**
  
  ```bash
    yarn add ng2-trim-directive
  ```
  
2. Import `InputTrimModule` 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
     <input type="text" trim />
     <textarea ... trim ></textarea>
  ```

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

  ```html
     <input type="text" trim="blur" />
     <textarea ... trim="blur" ></textarea>
  ```
  **note**: if you use the directive with <textarea> without setting the blur event, it will behave like the text input element.

---
Good luck.

---
_Source: https://npm.io/package/ng2-trim-directive · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
