Skip to content

Commit fc9ed63

Browse files
committed
chore(publish): release v0.4.0
1 parent f131f33 commit fc9ed63

File tree

4 files changed

+48
-9
lines changed

4 files changed

+48
-9
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 0.4.0 (2020-01-11)
2+
3+
### Features
4+
5+
* add structural directive for controlled errors management
6+
* add standard names for components
7+
8+
19
## 0.3.0 (2019-11-19)
210

311
## Breaking Changes

README.md

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ if the key is not present in the language file the message fallbacks to `${defau
2222

2323
## Usage
2424

25+
2526
Import it using
26-
```
27+
```typescript
2728
import {NgxValidationErrorsModule} from '@xtream/ngx-validation-errors';
2829

2930
@NgModule({
@@ -37,25 +38,52 @@ import {NgxValidationErrorsModule} from '@xtream/ngx-validation-errors';
3738
export class AppModule {
3839
}
3940
```
41+
### Components with auto errors injection
42+
now you can use validationContext and ngxValidationErrorsField in your template
4043

41-
now you can use validationContext and formFieldContainer in your template
42-
43-
```
44+
```angular2html
4445
<form [formGroup]="heroForm" validationContext="USER.REGISTRATION">
45-
<div formFieldContainer>
46+
<div ngxValidationErrorsField>
4647
<label>Name</label>
4748
<input formControlName="name"/>
4849
</div>
4950
</form>
5051
```
52+
or
53+
```angular2html
54+
<form [formGroup]="heroForm" validationContext="USER.REGISTRATION">
55+
<ngx-validation-errors-field>
56+
<label>Name</label>
57+
<input formControlName="name"/>
58+
</ngx-validation-errors-field>
59+
</form>
60+
```
5161

5262
According to the Validators set in the FormControl the errors appear when the input is invalid, dirty and touched.
5363

64+
### Structural directive
65+
66+
The structural directive has been created for special layout library (like material-ui) that have special input/errors
67+
components that do non allow to autoInject errors component. The usage is a little bit more verbose but the you control
68+
errors
69+
70+
```angular2html
71+
<form [formGroup]="heroForm" validationContext="USER.REGISTRATION">
72+
<mat-form-field *ngxValidationErrors="heroForm.get('name'); errors as errors">
73+
<input matInput formControlName="name" placeholder="name"/>
74+
<mat-error *ngIf="errors">{{errors}}</mat-error>
75+
</mat-form-field>
76+
</form>
77+
```
78+
79+
the structural directive needs the form control as parameter (like heroForm.get('name'), if you find a better way to retrieve the inner form control instance please open an issue).
80+
It exposes errors in the template context so you can use them in the ui.
81+
5482
### Clearing
5583

5684
The ValidationContextComponent has an imperative clear that resets all the fields removing all the errors.
5785

58-
```
86+
```typescript
5987
import {ValidationContextComponent} from '@xtream/ngx-validation-errors';
6088

6189

@@ -71,7 +99,7 @@ import {ValidationContextComponent} from '@xtream/ngx-validation-errors';
7199

72100
The library can be configured using the `forRoot` static method
73101

74-
```
102+
```typescript
75103
import {NgxValidationErrorsModule} from '@xtream/ngx-validation-errors';
76104

77105
@NgModule({

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-validation-errors",
3-
"version": "0.3.0",
3+
"version": "0.4.0",
44
"scripts": {
55
"ng": "ng",
66
"start": "ng serve",
@@ -13,16 +13,19 @@
1313
"private": true,
1414
"dependencies": {
1515
"@angular/animations": "~7.2.0",
16+
"@angular/cdk": "~7.3.7",
1617
"@angular/common": "~7.2.0",
1718
"@angular/compiler": "~7.2.0",
1819
"@angular/core": "~7.2.0",
1920
"@angular/forms": "~7.2.0",
21+
"@angular/material": "^7.3.7",
2022
"@angular/platform-browser": "~7.2.0",
2123
"@angular/platform-browser-dynamic": "~7.2.0",
2224
"@angular/router": "~7.2.0",
2325
"@ngx-translate/core": "^11.0.1",
2426
"@ngx-translate/http-loader": "^4.0.0",
2527
"core-js": "^2.5.4",
28+
"hammerjs": "^2.0.8",
2629
"ngx-bootstrap": "^4.1.1",
2730
"rxjs": "~6.3.3",
2831
"tslib": "^1.9.0",

projects/xtream/ngx-validation-errors/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@xtream/ngx-validation-errors",
33
"author": "Luca Micieli <[email protected]>",
4-
"version": "0.3.0",
4+
"version": "0.4.0",
55
"repository": {
66
"url": "https://github.com/xtreamsrl/ngx-validation-errors"
77
},

0 commit comments

Comments
 (0)