# angular-validation-message

> angular directive that inserts @angular/forms validation message right after your validating control

Latest version **6.0.0** (published 2021-06-15) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install angular-validation-message
pnpm add angular-validation-message
yarn add angular-validation-message
bun add angular-validation-message
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 6.0.0 |
| Published | 2021-06-15 |
| First published | 2017-12-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10.0.0 |
| Dependencies | 2 |
| Unpacked size | 145.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Sergey Romanchuk |
| Maintainers | romanchuk |

## Links

- npm: https://www.npmjs.com/package/angular-validation-message
- Repository: https://github.com/Romanchuk/angular-validation-message
- Homepage: https://github.com/Romanchuk/angular-validation-message#readme
- Issues: https://github.com/Romanchuk/angular-validation-message/issues
- npm.io page: https://npm.io/package/angular-validation-message

## Dependencies (2)

- [tslib](https://npm.io/package/tslib.md) ^2.2.0
- [angular-i18next](https://npm.io/package/angular-i18next.md) >=10.0.0 <13.0.0

## Recent versions

- 6.0.0 (latest) — 2021-06-15
- 7.0.0-0 (next) — 2022-02-17
- 6.0.0-0 — 2021-06-15
- 5.0.0-3 — 2021-04-05
- 4.0.0 — 2020-07-07
- 3.1.0 — 2020-04-29
- 3.0.1 — 2020-02-17
- 2.0.1 — 2019-08-07
- 2.0.0 — 2019-08-06
- 2.0.0-beta — 2019-08-06
- 1.3.0 — 2019-05-31
- 1.2.1 — 2019-03-05
- 1.1.0 — 2018-12-03
- 1.2.0 — 2018-11-28
- 1.0.0 — 2018-06-11
- … 1 more at https://npm.io/package/angular-validation-message/versions

## README

# 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](https://angular.io/guide/reactive-forms#step-2-making-a-field-required).

Before (dirty *ngIf markup):
```html
<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):
```html
 <input validationMessage name="email" type="email" class="form-control" formControlName="email" [(ngModel)]="model.email" />
 ```

- [Demo project](https://github.com/Romanchuk/angular-i18next-demo)
- [Live demo](https://romanchuk.github.io/angular-i18next-demo/)

## 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

---
_Source: https://npm.io/package/angular-validation-message · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
