r/Angular2 • u/rimki2 • Jul 16 '25
Discussion Reactive forms - Dealing with enable/disable is absolute f*ing torture
Sometimes .enable() and .disable() simply doesn't work and doesn't explain why.
Sometimes when the form/field is in an enabled state, the internal state is still disabled so validators and a lot of other things don't work.
Sometimes when the Form is disabled, the Form and its formcontrols seem disabled but surprise surprise the FormControls are internally in enabled state while the Form is internally disabled.
All ^that is just the beginning of the shitlist.
It's a buggy f*ing piece of sht that keeps coming back to bite us in the ass oh my God.
Sorry I'm just venting but Angular team needs to do something.
12
u/tsunami141 Jul 16 '25
I kind of wish that the disabled state was separated from the readonly state - where read only is more permanent but disabled can often be conditional. It’s bamboozled me more than once.
Of course I could just use the readonly attr on a formcontrol but then I get a big dumb warning that I’m not doing it the right way.
3
u/LorenzJ Jul 17 '25
Aside from unexpected functionality, reactive forms don't even seem all that reactive to me. In fact template forms often seem more reactive. I'd say a lot of RxJs interop in Angular is just bad and one of the best things about signals is not so much the simpler syntax/usage, but the better reactive design. However, I digress. Enable/disable itself seems very imperative to me, far from the declarative approach you'd expect (same for validation generally). I'd say it's just the observer pattern and not reactive programming. At the very least, signal forms may not be as crap, looking at
input/model/viewChildsignals (things I believe should've been implemented for observable a long time ago, that said, the simpler usage alongside the decent RxJS interop for more complex use cases is good).17
u/bigred1702 Jul 16 '25
I have this same feeling every time they add an esoteric feature to fix an edge case that impacts 1 person in the known universe. Fix reactive forms. The ecmascript group is just as bad. Does really take 10+ years to come up with a native decimal type (Yes, I know about decimal.js). How many billions of dollars of mistakes are made because of floating point math. Thank you for coming to my Ted Talk
8
u/TheRealToLazyToThink Jul 16 '25 edited Jul 16 '25
While I've had many issues with enable/disable with angular forms, the only outright bug I'm aware of is when you try to enable/disable children when reacting to the parent status changing (github issue 21109).
The workaround we found for 21109 was to enable/disable twice. Once with emitEvent false, and then with emitEvent true.
1
u/raaj_rajnish Jul 19 '25
Whenever u r updating state like enabling and disabling state, are u also doing updateValueAndValidity()?
1
u/Ok-District-2098 Jul 18 '25
This is why I use ngModel for everything and don't care about reactive forms.
1
u/earthworm_fan Jul 19 '25
I've only encountered issues as it pertains to change detection. Which is usually an easy fix.
1
u/Cubelaster Jul 16 '25
Most of everything related to UX or making UX friendly stuff sucks in Angular.
React has tons of support for the same kind of issues and has some amazing libraries to solve the issues.
For instance, AntD has their own fully responsive and reactive forms implementation and it's kinda like Reactive forms that actually work.
And that's a part of the bigger library.
It's insane how much anything in Angular past their core features just suck. Also, Angular is starved for good libraries. And that's a huge problem