How to use the ngrx-forms.formGroupReducer function in ngrx-forms

To help you get started, we’ve selected a few ngrx-forms examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MrWolfZ / ngrx-forms / example-app / src / app / dynamic / dynamic.reducer.ts View on Github external
export function formStateReducer(
  s = INITIAL_STATE,
  a: CreateGroupElementAction | RemoveGroupElementAction,
) {
  s = formGroupReducer(s, a);

  switch (a.type) {
    case CreateGroupElementAction.TYPE:
      return updateGroup({
        group: group => {
          const newGroup = addGroupControl(group, a.name, false);

          // alternatively we can also use setValue
          // const newValue = { ...group.value, [a.name]: false };
          // const newGroup = setValue(group, newValue);

          return newGroup;
        },
      })(s);

    case RemoveGroupElementAction.TYPE:
github MrWolfZ / ngrx-forms / example-app / src / app / value-boxing / value-boxing.reducer.ts View on Github external
formState(s = INITIAL_STATE, a: Action) {
    return formGroupReducer(s, a);
  },
});
github MrWolfZ / ngrx-forms / example-app / src / app / local-state-advanced / local-state-advanced.reducer.ts View on Github external
formState(fs = INITIAL_FORM_STATE, a: Action) {
    return formGroupReducer(fs, a);
  },
});
github MrWolfZ / ngrx-forms / example-app / src / app / simple-form / simple-form.reducer.ts View on Github external
formState(s = INITIAL_STATE, a: Action) {
    return formGroupReducer(s, a);
  },
  submittedValue(s: FormValue | undefined, a: SetSubmittedValueAction) {
github MrWolfZ / ngrx-forms / example-app / src / app / sync-validation / sync-validation.reducer.ts View on Github external
formState(s = INITIAL_STATE, a: Action) {
    return validateAndUpdateForm(formGroupReducer(s, a));
  },
  submittedValue(s: FormValue | undefined, a: SetSubmittedValueAction) {
github MrWolfZ / ngrx-forms / example-app / src / app / recursive-update / recursive-update.reducer.ts View on Github external
export function formStateReducer(state = INITIAL_STATE, a: BlockUIAction | UnblockUIAction) {
  state = formGroupReducer(state, a);

  switch (a.type) {
    case BlockUIAction.TYPE: {
      state = updateRecursive(
        state,
        s => setUserDefinedProperty(s, 'wasDisabled', s.isDisabled),
      );
      return disable(state);
    }

    case UnblockUIAction.TYPE: {
      state = enable(state);
      return updateRecursive(
        state,
        s => s.userDefinedProperties.wasDisabled ? disable(s) : s,
      );
github MrWolfZ / ngrx-forms / example-app / src / app / array / array.reducer.ts View on Github external
formState(s = INITIAL_STATE, a: Action) {
    return formGroupReducer(s, a);
  },
});
github MrWolfZ / ngrx-forms / example-app / src / app / local-state-introduction / local-state-introduction.reducer.ts View on Github external
export function reducer(fs: FormGroupState = INITIAL_FORM_STATE, a: Action) {
  return formGroupReducer(fs, a);
}
github MrWolfZ / ngrx-forms / example-app / src / app / value-conversion / value-conversion.reducer.ts View on Github external
formState(s = INITIAL_STATE, a: Action) {
    return formGroupReducer(s, a);
  },
});