Skip to content

Validation errors do not appear on submit with nested form controls (and ChangeDetection.OnPush) #317

Open
@david-bulte

Description

@david-bulte

When some form controls are on a nested component, validation erros do not always appear on submit.

Check out this stackblitz: https://stackblitz.com/edit/angular-ivy-kprprr

Case 1) No nested component
When clicking submit, error messages appear underneath the controls.

Case 2) With nested component
When clicking submit, error messages do not appear underneath the controls

Case 3) Nested component and explicitedly call form.markAllAsTouched()
When clicking submit, and calling form.markAllAsTouched in the submit method, error messages do appear.

Case 4) Nested component that has ChangeDetection.OnPush
However, even when calling form.markAllAsTouched(), error messages do not appear when clicking submit.

Is this a bug? Or is there a workaround to make this work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions