form-control-errors
Version:
This is a package built to make displaying validation errors from Angular Form Controls easier.
34 lines (25 loc) • 683 B
Markdown
This is a package built to make displaying validation errors from Angular Form Controls easier.
In module:
```js
import { NgFormErrorsModule } from 'form-control-errors'
...
imports: [
...
NgFormErrorsModule,
...
]
```
```js
<lib-form-errors [form]="exampleForm" [errorMsgs]="errorMsgs"></lib-form-errors>
```
form should be an Angular form group
errorMsgs should be an object of the following format
```js
{
email: 'is not formatted correctly',
required: 'is required'
}
```
where the key is the error key returned by the validator and the value is the message to display