Skip to content

Question: Update parent form state based on child control states #317

@skabhiyanta

Description

@skabhiyanta

I am binding table using ngrx-forms formStateArray. I want to mark controls as dirty when the original value is not equal to user entered value. I tried with following
onNgrxFormsAction(MarkAsDirtyAction, (state, action) => {
let newFormArrayState = state.formState;
if (originalValue === newValue) {
const pristineAction = new MarkAsPristineAction(action.controlId);
newFormArrayState = formArrayReducer(state.formState, pristineAction);
}

return {
    ...state,
    formState: newFormArrayState,
}

}),

The code above is updating the control as pristine. How to update parent form state based on all of its child?
Or is there any way to achieve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions