How to use the ngrx-forms.updateRecursive 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 / 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,
      );
    }

    default: {
      return state;
    }
  }
}
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,
      );
    }

    default: {
      return state;