ng-trim-value-accessor
TypeScript icon, indicating that this package has built-in type declarations

3.0.2 • Public • Published

TrimValueAccessor for Angular

Angular's missing trim input functionality (equivalent of AngularJS ng-trim)

Caveat: It's a drop-in solution, meaning it applies to all input fields as soon as this module is used.

Installation

To install this library, run:

$ npm install ng-trim-value-accessor --save

Usage

In your Angular AppModule:

import { NgModule } from '@angular/core';
import { TrimValueAccessorModule } from 'ng-trim-value-accessor';
 
@NgModule({
  imports: [
    TrimValueAccessorModule
  ]
})
export class AppModule { }

Opt-out

By default, it ignores all readonly and input[type="password] fields. For example the following field remains untouched:

<input class="form-control" name="startDate" [(ngModel)]="model.startDate" ngbDatepicker readonly>

However if you want to explicitly opt-out, give a field ng-trim-ignore css class:

<input type="text" class="form-control ng-trim-ignore" name="firstName" [(ngModel)]="model.firstName">

Package Sidebar

Install

npm i ng-trim-value-accessor

Weekly Downloads

809

Version

3.0.2

License

MIT

Unpacked Size

94 kB

Total Files

24

Last publish

Collaborators

  • khashayar