Skip to content

Commit e540d21

Browse files
authored
Merge pull request #23 from borisfox73/master
Missing defaults when form control errors is null in FormFieldEmptyContainerDirective
2 parents 399cb42 + 2972ba4 commit e540d21

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

projects/xtream/ngx-validation-errors/src/lib/form-field-empty-container.directive.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export class FormFieldEmptyContainerDirective implements DoCheck {
4949
const hasError = (!this.formControl.valid && this.formControl.touched) && !this.validationDisabled;
5050
let messages;
5151
if (hasError) {
52-
messages = Object.keys(this.formControl.errors).map(error => {
52+
messages = Object.keys(this.formControl.errors || {}).map(error => {
5353
const fieldName = this.formControlName;
5454
const errorKey = `${toScreamingSnakeCase(fieldName)}.ERRORS.${toScreamingSnakeCase(error)}`;
5555
if (this.messageProvider &&
@@ -59,7 +59,7 @@ export class FormFieldEmptyContainerDirective implements DoCheck {
5959
return `${this.validationContext}.${errorKey}`;
6060
}
6161
});
62-
const params = Object.values(this.formControl.errors).reduce((a, b) => {
62+
const params = Object.values(this.formControl.errors || {}).reduce((a, b) => {
6363
a = {...a, ...b};
6464
return a;
6565
}, {});

0 commit comments

Comments
 (0)