-
Notifications
You must be signed in to change notification settings - Fork 33
-
Notifications
You must be signed in to change notification settings - Fork 33
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
The disabled
attribute does not work on a top level form which is an array
#84
Comments
☝️ Wrote a test for that and couldn't repro 🤔 |
I was able to repro and understand what's happening. I've tried to write a fix to see if it would be that and it worked. PR on the way but missing tests for now. EDIT: about the "workaround: obvious" --> instead of passing |
We've noticed the same behaviour when FormArray's are in SubForms. When initially |
After a few hours of investigation and banging my head on a wall, I found out really really weird issues with Angular and disabled forms: angular/angular#31506 To explain a bit the weird behavior I did encounter here:
ngx-sub-form/projects/ngx-sub-form/src/lib/ngx-sub-form.component.ts Lines 238 to 240 in e01e19a
const fgDisabled: boolean = this.formGroup.disabled;
this.formGroup.setValue(transformedValue, {
emitEvent: false,
});
if (fgDisabled) {
this.formGroup.disable();
} ✔️ I do not understand, I'm not sure how to repro and therefore can't write a test but I've made a comment explaining that in the code so it doesn't go away 👍 Fix coming soon |
🎉 This issue has been resolved in version 3.0.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@areijngoudt you can upgrade to the new version 👆 Let us know how it goes and if it fixes the issue on your side too 😸 |
🎉 This issue has been resolved in version 3.0.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
actually I dealt with 2 errors at the same time and the first one might not be the one you needed. You should rather grab latest (3.0.6) instead of 3.0.5 👍 |
@maxime1992 works like a charm, thanks! I still have one question: when the form is set to disabled (using the [disabled] input property), the formGroup becomes dirty (while the form values have not changed). Is there a way to prevent this? |
Glad to hear that 👍 !
Sounds like a bug @areijngoudt can you create a new issue please? |
Trying to get the top level form disabled in the following case (where
currentStateRotors
is an array):The disabled property is not taken into account.
It should loop over the array and disable all the controls from the array.
The text was updated successfully, but these errors were encountered: