Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

anein/angular2-trim-directive

Repository files navigation

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 <textarea> without setting the blur event, it will behave like the text input element.


Good luck.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 9

AltStyle によって変換されたページ (->オリジナル) /