angular / angular/components

Support for composite forms

Open
#10,508 9 comments 3 reactions 0 assignees View on GitHub
area: material/form-field P4
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

#### feature request: Support for composite forms

#### What is the expected behavior?
Allow building of composite forms using material components.

#### What is the current behavior?
The controls won't pick up the correct parent form when in a composite form so their errors won't be shown according to the error state matcher. There are also no hooks for listening for blur on controls like select so we can propagate the touch event.

#### What are the steps to reproduce?
https://stackblitz.com/edit/angular-material2-issue-3vwszx
In the above stackbliz, is an example using just 2 inputs for first name, last name. In my use case there would be more than just 2 inputs but it demonstrates the issue. On the composite form when submit is clicked, the error messages are not shown. On the inline form when submit is clicked, the error messages correctly display.

#### What is the use-case or motivation for changing an existing behavior?
Being able to group many different controls under one composite control so it can be easily reused inside of a reactive or template driven form.

#### Is there anything else we should know?
Using the principles explained in the angular connect talk here https://www.youtube.com/watch?v=CD_t3m2WMM8&feature=youtu.be&t=1645

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and compare the composite and inline reactive or template-driven forms when Submit is clicked. Review the Angular Connect principles linked in the issue, then trace how the material controls find their parent form and expose blur or touch state. Done means reusable composite forms display control errors and propagate touch state consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.