René's URL Explorer Experiment


Title: make it easier to access the submitted status of a form · Issue #48402 · angular/angular · GitHub

Open Graph Title: make it easier to access the submitted status of a form · Issue #48402 · angular/angular

X Title: make it easier to access the submitted status of a form · Issue #48402 · angular/angular

Description: Which @angular/* package(s) are relevant/related to the feature request? forms Description Several libraries (like ngx-valdemort or angular material) use the submitted property of the parent formGroupDirective in order to decide whether ...

Open Graph Description: Which @angular/* package(s) are relevant/related to the feature request? forms Description Several libraries (like ngx-valdemort or angular material) use the submitted property of the parent formGr...

X Description: Which @angular/* package(s) are relevant/related to the feature request? forms Description Several libraries (like ngx-valdemort or angular material) use the submitted property of the parent formGr...

Opengraph URL: https://github.com/angular/angular/issues/48402

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"make it easier to access the submitted status of a form","articleBody":"### Which @angular/* package(s) are relevant/related to the feature request?\r\n\r\nforms\r\n\r\n### Description\r\n\r\nSeveral libraries (like ngx-valdemort or angular material) use the `submitted` property of the parent formGroupDirective in order to decide whether or not to display error messages. This works fine as long as the form group directive is only used on the top-level form, and not for nested form groups.\r\n\r\nSee [this working example](https://stackblitz.com/edit/angular-zgmq7p?file=src%2Fapp%2Fform-field-error-example.ts,src%2Fapp%2Fform-field-error-example.html), using formGroupName for the nested form group and [this non-working example](https://stackblitz.com/edit/angular-zgmq7p-2ygua5?file=src%2Fapp%2Fform-field-error-example.ts,src%2Fapp%2Fform-field-error-example.html), using formGroup for the nested form group.\r\n\r\nOne might say that using formGroupName is an easy-enough alternative but\r\n- with typed forms, it's less type-safe\r\n- it is possible, but more complex, to use it from a child component, because it requires a parent formGroupDirective in the same template, unless a view provider is specified for ControlContainer, but that's far from easy to find out, and has its limitations. AFAIK, most people pass the FormGroup as input to the child component, which then uses the formGroup directive.\r\n\r\n### Proposed solution\r\n\r\nThere are several solutions I can see\r\n\r\n1. being able, from the formGroupDirective, to navigate to its parent, recursively, until getting to the top-level one which contains the correct submitted value\r\n2. Add some additional topLevelFormGroup directive, which could use the new directive composition API, and which would get a reference to the formGroupDirective on the same host to give access to it. This TopLevelFormGroupDirective could then be injected in place of the FormGroupDirective to get direct access to the submitted flag\r\n3. Have the formGroupDirective store the submitted flag in its form group, just like it's done for similar flages such as touched, dirty. Since FormGroups do have a reference to their parent, libraries needing to access the submitted property could easily navigate to the top-level directive\r\n4. ???\r\n\r\nThe third solution seems like the most logical to me. It has the additional advantage that it could allow `FormGroup.reset()` to also reset the submitted flag, just as it resets the touched flags.\r\n\r\n\r\n### Alternatives considered\r\n\r\nClearly document that formGroupDirective is only ever supposed to be used for the top-level form (some parts of the doc suggest that, like the documentation of the `path` property of FormGroupDirective, but on the other hands, I've seen many usages of the formGroupDirective in the wild for nested form groups), and clearly document how to best delegate the display of a nested form group to a child component, using `formGroupName`. The best solution I've found is to use the following in the parent component:\r\n\r\n```html\r\n\u003cdiv formGroupName=\"address\"\u003e\r\n  \u003capp-address\u003e\u003c/app-address\u003e\r\n\u003c/div\u003e\r\n```\r\n\r\nand use this in the decorator of the child component to be able to access the parent form group name:\r\n\r\n```ts\r\n  viewProviders: [{ provide: ControlContainer, useExisting: FormGroupName }]\r\n```\r\n\r\nBut this solution isn't without problems. For example: it forces every usage of address to be inside a formGroupName. It can't be used directly under a formGroupDirective. It's also not obvious at all.","author":{"url":"https://github.com/jnizet","@type":"Person","name":"jnizet"},"datePublished":"2022-12-08T13:16:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/48402/angular/issues/48402"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:764cd93b-0204-1d3a-d56d-2a5db39357a4
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCCFC:31F73:388939:48D458:69757190
html-safe-nonceb20a922e1e85eecfcdcd3911e6a6ceddff5d4e3a58a4fae178d66dff84e6dfde
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQ0ZDOjMxRjczOjM4ODkzOTo0OEQ0NTg6Njk3NTcxOTAiLCJ2aXNpdG9yX2lkIjoiMTMwNjIyMjEwNzgyMzU5OTUyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac3acac9a44b3dd0d82e1277f249af40d5ba32cbd4b282e586ff89f7d858523afe
hovercard-subject-tagissue:1484621855
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/48402/issue_layout
twitter:imagehttps://opengraph.githubassets.com/fd55124e3d7c12bc8dee301fc44035f45009c8ae71b59221c1516908d96a6abc/angular/angular/issues/48402
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/fd55124e3d7c12bc8dee301fc44035f45009c8ae71b59221c1516908d96a6abc/angular/angular/issues/48402
og:image:altWhich @angular/* package(s) are relevant/related to the feature request? forms Description Several libraries (like ngx-valdemort or angular material) use the submitted property of the parent formGr...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejnizet
hostnamegithub.com
expected-hostnamegithub.com
None4a4bf5f4e28041a9d2e5c107d7d20b78b4294ba261cab243b28167c16a623a1f
turbo-cache-controlno-preview
go-importgithub.com/angular/angular git https://github.com/angular/angular.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id24195339
octolytics-dimension-repository_nwoangular/angular
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24195339
octolytics-dimension-repository_network_root_nwoangular/angular
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release488b30e96dfd057fbbe44c6665ccbc030b729dde
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/angular/angular/issues/48402#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F48402
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F48402
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular
Reloadhttps://patch-diff.githubusercontent.com/angular/angular/issues/48402
Reloadhttps://patch-diff.githubusercontent.com/angular/angular/issues/48402
Reloadhttps://patch-diff.githubusercontent.com/angular/angular/issues/48402
angular https://patch-diff.githubusercontent.com/angular
angularhttps://patch-diff.githubusercontent.com/angular/angular
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fangular%2Fangular
Fork 27k https://patch-diff.githubusercontent.com/login?return_to=%2Fangular%2Fangular
Star 99.8k https://patch-diff.githubusercontent.com/login?return_to=%2Fangular%2Fangular
Code https://patch-diff.githubusercontent.com/angular/angular
Issues 1k https://patch-diff.githubusercontent.com/angular/angular/issues
Pull requests 128 https://patch-diff.githubusercontent.com/angular/angular/pulls
Discussions https://patch-diff.githubusercontent.com/angular/angular/discussions
Actions https://patch-diff.githubusercontent.com/angular/angular/actions
Projects 2 https://patch-diff.githubusercontent.com/angular/angular/projects
Security 4 https://patch-diff.githubusercontent.com/angular/angular/security
Insights https://patch-diff.githubusercontent.com/angular/angular/pulse
Code https://patch-diff.githubusercontent.com/angular/angular
Issues https://patch-diff.githubusercontent.com/angular/angular/issues
Pull requests https://patch-diff.githubusercontent.com/angular/angular/pulls
Discussions https://patch-diff.githubusercontent.com/angular/angular/discussions
Actions https://patch-diff.githubusercontent.com/angular/angular/actions
Projects https://patch-diff.githubusercontent.com/angular/angular/projects
Security https://patch-diff.githubusercontent.com/angular/angular/security
Insights https://patch-diff.githubusercontent.com/angular/angular/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/angular/angular/issues/48402
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/angular/angular/issues/48402
make it easier to access the submitted status of a formhttps://patch-diff.githubusercontent.com/angular/angular/issues/48402#top
area: formshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20forms%22
needsTriagehttps://github.com/angular/angular/milestone/83
https://github.com/jnizet
https://github.com/jnizet
jnizethttps://github.com/jnizet
on Dec 8, 2022https://github.com/angular/angular/issues/48402#issue-1484621855
this working examplehttps://stackblitz.com/edit/angular-zgmq7p?file=src%2Fapp%2Fform-field-error-example.ts,src%2Fapp%2Fform-field-error-example.html
this non-working examplehttps://stackblitz.com/edit/angular-zgmq7p-2ygua5?file=src%2Fapp%2Fform-field-error-example.ts,src%2Fapp%2Fform-field-error-example.html
area: formshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20forms%22
needsTriageNo due datehttps://github.com/angular/angular/milestone/83
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.