How to use the ngrx-forms.disable 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 / app.reducer.ts View on Github external
priority: priority => {
        if (itemForm.value.category === 'Private') {
          return setValue(0, disable(priority));
        }

        return priority.isEnabled ? priority : setValue(1, enable(priority));
      },
    })(cast(meta)),
github MrWolfZ / ngrx-forms / example-app / src / app / sync-validation / sync-validation.reducer.ts View on Github external
password: (state, parentState) => {
    if (!parentState.value.createAccount) {
      return disable(state);
    }

    state = enable(state);
    state = validate(state, validatePasswordsMatch);
    return updateGroup(state, {
      password: validate(required, minLength(8)),
    });
  },
  agreeToTermsOfUse: validate(requiredTrue),
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 / material-example / material.reducer.ts View on Github external
password: (state, parentState) => {
    if (!parentState.value.createAccount) {
      return disable(state);
    }

    state = enable(state);
    return updateGroup(state, {
      password: validate(required, minLength(8)),
      confirmPassword: validate(equalTo(state.value.password)),
    });
  },
  agreeToTermsOfUse: validate(requiredTrue),