src/ngx-form-errors/src/ngx-errors.component.ts
A Component that render form errors for a form controller attached to it.
The component is used as a directive on any renderable element (i.e. not on ng-container
).
<input type="password" id="password" formControlName="password" />
<div ngxErrors="password"></div>
- The component is used as a placeholder and all errors are added as siblings to the component. This approach enables support for content projected error directive, e.g. material's
md-error
.- The actual rendered content is based on the scoped template and not on the component
changeDetection | ChangeDetectionStrategy.OnPush |
selector | [ngxErrors] |
exclude
|
A list of error keys (e.g. "required") that will be excluded (i.e. will not render)
This is a full-compare version of |
maxError
|
Maximum number of errors to display |
ngxErrors
|
A string or a control that is the source of errors for this component. When a string is used, a lookup is done on the first
Reactive Form:The string
Template-Driven Form:The string
|
order
|
A list of error keys that defines the order of which errors appear. The list can be partial, following errors will display in the order they were added. |
renderIf
|
A predicate that allows filtering out error message right before they are displayed. |
constructor(ngxErrorsService: NgxErrorsService, control: ControlContainer, vcr: ViewContainerRef)
|