6.0.0 • Published 2 years ago

angular-validation-message v6.0.0

Weekly downloads
173
License
MIT
Repository
github
Last release
2 years ago

angular-validation-message

ValidationMessageModule gives you possibility to localize form validators and it automatically puts localized validator error message to markup (if there is one). Fully compatable with angular reactive form validators.

Before (dirty *ngIf markup):

<input id="name" name="name" class="form-control"
      required minlength="4" appForbiddenName="bob"
      [(ngModel)]="hero.name" #name="ngModel" >
<div *ngIf="name.errors.minlength">
    Name must be at least 4 characters long.
</div>

After (clean markup with auto inserting error messages):

 <input validationMessage name="email" type="email" class="form-control" formControlName="email" [(ngModel)]="model.email" />

Installation

  1. npm install angular-validation-message

  2. Import ValidationMessageModule to module where you expect to enable error message to form fields
  3. Set validationMessage directive to any form fields

Providers

I18NextValidationMessageModule

Bridge for "angular-validation-message" for translate error messages via i18next.

Requirements:

  1. npm install i18next angular-i18next

  2. import I18NextValidationMessageModule insteand of ValidationMessageModule

Custom providers

You can implement your own provider. Check source code of I18NextValidationMessageModule as example

Migration

Since v2 angular-validation-message includes providers

7.0.0-0

2 years ago

6.0.0

3 years ago

6.0.0-0

3 years ago

5.0.0-3

3 years ago

4.0.0

4 years ago

3.1.0

4 years ago

3.0.1

4 years ago

2.0.1

5 years ago

2.0.0

5 years ago

2.0.0-beta

5 years ago

1.3.0

5 years ago

1.2.1

5 years ago

1.1.0

5 years ago

1.2.0

5 years ago

1.0.0

6 years ago

0.1.0

6 years ago