diff --git a/demo-app/ng7/src/app/pages/ngx-forms-example/ngx-forms-example.component.html b/demo-app/ng7/src/app/pages/ngx-forms-example/ngx-forms-example.component.html index 9468c50..9e2e357 100644 --- a/demo-app/ng7/src/app/pages/ngx-forms-example/ngx-forms-example.component.html +++ b/demo-app/ng7/src/app/pages/ngx-forms-example/ngx-forms-example.component.html @@ -23,7 +23,7 @@

Reactive Forms with NgxFormErrors

/> @@ -40,10 +40,7 @@

Reactive Forms with NgxFormErrors

required /> - + diff --git a/demo-app/ng7/src/app/parent-error-state-matcher.ts b/demo-app/ng7/src/app/parent-error-state-matcher.ts index 2057c1b..a21f317 100644 --- a/demo-app/ng7/src/app/parent-error-state-matcher.ts +++ b/demo-app/ng7/src/app/parent-error-state-matcher.ts @@ -5,8 +5,8 @@ import { FormControl, FormGroupDirective, NgForm } from "@angular/forms"; export class ParentErrorStateMatcher implements ErrorStateMatcher { public isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean { const isSubmitted: boolean = !!(form && form.submitted); - const formGroupValid: boolean = !!(form && form.valid); + const formGroupInvalid: boolean = !!(form && form.invalid); - return !!((control && control.invalid && (control.dirty || control.touched)) || isSubmitted || formGroupValid); + return !!(control && (control.invalid || formGroupInvalid) && (control.dirty || control.touched || isSubmitted)); } } diff --git a/demo-app/ng8/src/app/pages/ngx-forms-example/ngx-forms-example.component.html b/demo-app/ng8/src/app/pages/ngx-forms-example/ngx-forms-example.component.html index 9468c50..9e2e357 100644 --- a/demo-app/ng8/src/app/pages/ngx-forms-example/ngx-forms-example.component.html +++ b/demo-app/ng8/src/app/pages/ngx-forms-example/ngx-forms-example.component.html @@ -23,7 +23,7 @@

Reactive Forms with NgxFormErrors

/> @@ -40,10 +40,7 @@

Reactive Forms with NgxFormErrors

required /> - + diff --git a/demo-app/ng8/src/app/parent-error-state-matcher.ts b/demo-app/ng8/src/app/parent-error-state-matcher.ts index 2057c1b..a21f317 100644 --- a/demo-app/ng8/src/app/parent-error-state-matcher.ts +++ b/demo-app/ng8/src/app/parent-error-state-matcher.ts @@ -5,8 +5,8 @@ import { FormControl, FormGroupDirective, NgForm } from "@angular/forms"; export class ParentErrorStateMatcher implements ErrorStateMatcher { public isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean { const isSubmitted: boolean = !!(form && form.submitted); - const formGroupValid: boolean = !!(form && form.valid); + const formGroupInvalid: boolean = !!(form && form.invalid); - return !!((control && control.invalid && (control.dirty || control.touched)) || isSubmitted || formGroupValid); + return !!(control && (control.invalid || formGroupInvalid) && (control.dirty || control.touched || isSubmitted)); } }