https://github.com/maxisam/ngx-trim
A directive to trim text input on keyup
https://github.com/maxisam/ngx-trim
angular2 input trim
Last synced: 3 months ago
JSON representation
A directive to trim text input on keyup
- Host: GitHub
- URL: https://github.com/maxisam/ngx-trim
- Owner: maxisam
- Created: 2017-10-10T18:42:37.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-20T15:09:21.000Z (about 7 years ago)
- Last Synced: 2025-01-29T21:52:48.714Z (12 months ago)
- Topics: angular2, input, trim
- Language: TypeScript
- Homepage:
- Size: 1.39 MB
- Stars: 3
- Watchers: 4
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/ngx-trim)
[](https://github.com/maxisam/ngx-trim/releases)
[]()
# ngx-trim
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.1.
Demo: https://stackblitz.com/github/maxisam/ngx-trim
## Installation
To install this library, run:
```bash
$ npm install ngx-trim --save
```
## Consuming your library
Once you have published your library to npm, you can import your library in any Angular application by running:
```bash
$ npm install ngx-trim
```
and then from your Angular `AppModule`:
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
// Import the library
import { NgxTrimModule } from 'ngx-trim';
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
// Import the library
NgxTrimModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
```
Once your library is imported, you can use its components, directives and pipes in your Angular application:
```xml
```
## Features
Trim text after input event, `focusout` or `keyup`.
You can set it as `ngxTrim='focusout'` or
## Development
To generate all `*.js`, `*.d.ts` and `*.metadata.json` files:
```bash
$ npm run build
```
To lint all `*.ts` files:
```bash
$ npm run lint
```
## Acknowledgement
This project uses [generator-angular2-library](https://github.com/jvandemo/generator-angular2-library)
## License
MIT © [Sam Lin](mailto:maxisam@gmail.com)