Title: FormControls are not usable in multiple formGroups · Issue #50957 · angular/angular · GitHub
Open Graph Title: FormControls are not usable in multiple formGroups · Issue #50957 · angular/angular
X Title: FormControls are not usable in multiple formGroups · Issue #50957 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? forms Is this a regression? Yes Description Right now using the same formControls in multiple formGroups is not possible. From the developer's point of view, I think it would be more...
Open Graph Description: Which @angular/* package(s) are the source of the bug? forms Is this a regression? Yes Description Right now using the same formControls in multiple formGroups is not possible. From the developer's...
X Description: Which @angular/* package(s) are the source of the bug? forms Is this a regression? Yes Description Right now using the same formControls in multiple formGroups is not possible. From the developer...
Opengraph URL: https://github.com/angular/angular/issues/50957
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"FormControls are not usable in multiple formGroups","articleBody":"### Which @angular/* package(s) are the source of the bug?\r\n\r\nforms\r\n\r\n### Is this a regression?\r\n\r\nYes\r\n\r\n### Description\r\n\r\nRight now using the same formControls in multiple formGroups is not possible. From the developer's point of view, I think it would be more intuitive in this case that the controls were synchronized. It seems that it only changes the value in the last formGroup that the controls are assigned to.\r\n\r\nExample:\r\n\r\n```\r\nuserControl = new FormControl('');\r\npassControl = new FormControl('');\r\n\r\nform1 = new FormGroup({\r\n user1: this.userControl,\r\n pass1: this.userControl\r\n});\r\n\r\nform2 = new FormGroup({\r\n user2: this.userControl,\r\n pass2: this.userControl\r\n});\r\n\r\nconstructor(){\r\n this.form1.valueChanges.subscribe((res) => {\r\n // Never enter here:\r\n console. log('FORM1 Changes');\r\n });\r\n\r\n this.form2.valueChanges.subscribe((res) => {\r\n console. log('FORM2 Changes');\r\n });\r\n}\r\n\r\n```\r\n\r\nIn the HTML:\r\n\r\n```\r\n\u003cform [formGroup]=\"form1\">\r\n \u003c!---- If you type here, the console prints 'FORM2 Changes' ------>\r\n \u003cinput type=\"text\" matInput formControlName=\"user1\" placeholder=\"user in form 1\">\r\n \u003cinput type=\"text\" matInput formControlName=\"pass1\" placeholder=\"pass in form 1\">\r\n\u003c/form>\r\n\r\n\r\n\u003cform [formGroup]=\"form2\">\r\n \u003cinput type=\"text\" matInput formControlName=\"user2\" placeholder=\"user in form 2\">\r\n \u003cinput type=\"text\" matInput formControlName=\"pass2\" placeholder=\"pass in form 2\">\r\n\u003c/form>\r\n\r\n```\r\n\r\n### Please provide a link to a minimal reproduction of the bug\r\n\r\n_No response_\r\n\r\n### Please provide the exception or error you saw\r\n\r\n_No response_\r\n\r\n### Please provide the environment you discovered this bug in (run `ng version`)\r\n\r\n```true\r\nAngular CLI: 15.2.8\r\nNode: 16.15.1\r\nPackage Manager: npm 8.14.0\r\nOS: win32 x64\r\n\r\nAngular: 15.2.9\r\n... animations, cdk, common, compiler, compiler-cli, core, forms\r\n... material, platform-browser, platform-browser-dynamic, router\r\n\r\nPackage Version\r\n---------------------------------------------------------\r\n@angular-devkit/architect 0.1502.8\r\n@angular-devkit/build-angular 15.2.8\r\n@angular-devkit/core 15.2.8\r\n@angular-devkit/schematics 15.2.8\r\n@angular/cli 15.2.8\r\n@schematics/angular 15.2.8\r\nrxjs 7.5.7\r\ntypescript 4.8.4\r\n```\r\n\r\n\r\n### Anything else?\r\n\r\n_No response_","author":{"url":"https://github.com/enrique-lozano","@type":"Person","name":"enrique-lozano"},"datePublished":"2023-07-06T08:08:38Z","url":"https://github.com/angular/angular/issues/50957"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7eb6d671-5985-88a6-2dc5-44f0f86fcf37 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8172:16AB79:16A9CC3:1CD37AE:6B0137F8 |
| html-safe-nonce | 0dca3dfff28f67c28f128d09397f6ef06eba510a1c0320df7edeaff7218903e3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTcyOjE2QUI3OToxNkE5Q0MzOjFDRDM3QUU6NkIwMTM3RjgiLCJ2aXNpdG9yX2lkIjoiMTIyODcyNDAyNDE1OTMyMDA1NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 21fbbcb2044e1c3f3adcad3a8768254f5411f4787339c757d110b4650a64daa7 |
| hovercard-subject-tag | issue:1791039733 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/50957/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0e7a83cc89b91c632f99d123863a488afcb0846710ba5f5af56c8b6b4ccf9d85/angular/angular/issues/50957 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0e7a83cc89b91c632f99d123863a488afcb0846710ba5f5af56c8b6b4ccf9d85/angular/angular/issues/50957 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? forms Is this a regression? Yes Description Right now using the same formControls in multiple formGroups is not possible. From the developer's... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | enrique-lozano |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width