@ngxs/form-plugin, disabling individual inputs is pain
I have a form where I need some inputs enabled and some disabled.
I have to do it in very ugly manner
Object.keys(formGroup.controls).forEach(fieldName => {
...
[some logic]
...
let field = formGroup.get(fieldName )
void enabled ? field.enabled() : field.disabled();
})
I have two sources of truth, input data is model in state, the enabled/disabled flags are in FormGroup instance which I have to manipulate in imperative way
Things are going worse when I set 'global' disabled to true or false. Then ngxs resets individual enabled/disabled of individual controls
Hmmmmmm....so a custom action that would only disable certain inputs? Should be possible but deep forms might get tricky. @tsawan - any thoughts?
It depends if (and how soon) we want to support complete state of FormGroup and FormControl. And if we do support these, then adding support for nested forms could become tricky.
I feel like that is getting a bit too deep into what could be controlled through the form itself. I don't think that that is a state management concern.
By @markwhitfeld (in Slack DM)