Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anein/angular2-trim-directive
the directive trims whitespaces from the end of an input text value.
https://github.com/anein/angular2-trim-directive
angular angularjs directive-trims-whitespaces javascript npm trim typescript
Last synced: 2 days ago
JSON representation
the directive trims whitespaces from the end of an input text value.
- Host: GitHub
- URL: https://github.com/anein/angular2-trim-directive
- Owner: anein
- License: mit
- Created: 2017-01-13T10:59:45.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-09-11T10:27:43.000Z (over 4 years ago)
- Last Synced: 2024-12-18T22:04:53.892Z (4 days ago)
- Topics: angular, angularjs, directive-trims-whitespaces, javascript, npm, trim, typescript
- Language: TypeScript
- Homepage:
- Size: 1.42 MB
- Stars: 46
- Watchers: 3
- Forks: 26
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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
```or with an option: trim value only on the blur event.
```html
```
**note**: if you use the directive with without setting the blur event, it will behave like the text input element.---
Good luck.