Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling markAllAsTouched() on parent form doesn't mark ControlContainer controls as touched #55046

Closed
eltaro opened this issue Mar 26, 2024 · 3 comments

Comments

@eltaro
Copy link

eltaro commented Mar 26, 2024

Which @angular/* package(s) are the source of the bug?

forms

Is this a regression?

No

Description

  1. Have a component with ControlContainer that is looking at a FormGroup in the parent form.
  2. From the parent component, call form.markAllAsTouched().
  3. Use devtools to observe the behavior. In the actual FormGroup object, the controls are correctly marked as touched, however, in the DOM, you will be able to see the controls inside the ControlContainer component aren't touched.

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-control-container-subform-markallastouched-bug?file=src%2Fmain.ts

Please provide the exception or error you saw

-

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.3.2
Node: 18.18.0
Package Manager: npm 10.2.3
OS: linux x64

Angular: 17.3.1
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.2
@angular-devkit/build-angular   17.3.2
@angular-devkit/core            17.3.2
@angular-devkit/schematics      17.3.2
@angular/cli                    17.3.2
@schematics/angular             17.3.2
rxjs                            7.8.1
typescript                      5.3.3
zone.js                         0.14.4

Anything else?

No response

@JeanMeche
Copy link
Member

You're issue is due to the OnPush strategy. CD isn't triggered on your CVA because your component isn't marked dirty in any way.

@JeanMeche JeanMeche closed this as not planned Won't fix, can't repro, duplicate, stale Mar 27, 2024
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 27, 2024
@JeanMeche
Copy link
Member

Btw if you are looking for a working for this issue,

it would be to subscribe to touchChanges via the v18 events observable and invoke markForCheck.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants