angular / angular/components

bug(MatFormField): Reactive Forms with FormGroup inside child component doesn't highlight when invalid

Open
#20,341 5 comments 1 reaction 0 assignees View on GitHub
area: material/form-field area: material/input forms P2
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

#### Reproduction

Use StackBlitz to reproduce your issue: https://stackblitz.com/edit/angular-material-formgroup-nested

Steps to reproduce:
1. Connect a form group to a child component (with custom input component) with validations configured
2. Submit the form without value and the form is invalid

#### Expected Behavior

All the input fields that are invalid to get highlighted.

#### Actual Behavior

Components that are on the root group are highlighted

#### Environment

- Angular: 10+
- CDK/Material:10.0.2 - 10.1.3
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and confirm the difference between invalid fields in the root form group and those inside the child component. Trace the Angular Material form-field behavior involved in invalid highlighting; done means all invalid input fields are highlighted after submitting the empty form.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.