Skip to content

Commit

Permalink
chore(readme): add new docs for hasError(‘*’)
Browse files Browse the repository at this point in the history
  • Loading branch information
toddmotto committed Apr 13, 2017
1 parent e67a8aa commit d7dce7c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,25 @@ You can optionally pass in conditions in which to activate the error.
</div>
```

You can also use the "catch-all" selector to get the state of your entire control's validity, alongside on an optional state collection.

```html
<div>
<div [ngClass]="{
invalid: myError.hasError('*'),
invalidTouchedDirty: myError.hasError('*', ['touched', 'dirty'])
}">
</div>
<input type="text" formControlName="username">
</div>

<div ngxErrors="username" #myError="ngxErrors">
<div ngxError="required" [when]="dirty">
Field is required
</div>
</div>
```

#### hasErrors: boolean;

The `hasErrors` property returns `true` if your control has any number of errors. This can be useful for styling elsewhere in your template on a global control level rather than individual errors.
Expand Down

0 comments on commit d7dce7c

Please sign in to comment.