Interface ReactiveFromInit<T>

Initial data for reactive form base class to feed to constructor.

interface ReactiveFromInit<T> {
    crud?: Crud<any, any>;
    data?: T;
    error?: ApiError;
    form: FormGroup<any>;
    getPayload?: (() => Dict);
    id?: PK;
    loading?: boolean;
    noIdExtractControls?: string[];
    payloadPipes?: PayloadPipe[];
    updateDataOnSubmit?: boolean;
    updateIdOnCreateSubmit?: boolean;
    useDirtyAsPayload?: boolean;
    viewMode?: boolean;
}

Type Parameters

Properties

crud?: Crud<any, any>
data?: T
error?: ApiError
form: FormGroup<any>
getPayload?: (() => Dict)

Type declaration

    • (): Dict
    • Get form value (payload) based on given parameters for manipulation. Override the value of this method for custom payload handling.

      Default value of this method is this code below, you can use it for custom modification if initial variables and pipes are not enough.

      const getPayload = (): Dict => {
      let payload: Dict = Object.assign({}, this.value);
      if (form.removeEmptyValuesFromPayload) {
      payload = removeEmptyValuesFromDict(
      payload,
      form.removeEmptyArraysFromPayload\
      );
      }
      if (form.useDirtyAsPayload) {
      payload = form.dirtyValue;
      }
      for (const pipe of form.payloadPipes) {
      payload = pipe(payload);
      }
      return payload;
      }

      Returns Dict

      • ReactiveForm.value
      • ReactiveForm.dirtyValue
      • ReactiveForm.useDirtyAsPayload
      • ReactiveForm.removeEmptyValuesFromPayload
id?: PK
loading?: boolean
noIdExtractControls?: string[]
payloadPipes?: PayloadPipe[]
updateDataOnSubmit?: boolean
updateIdOnCreateSubmit?: boolean
useDirtyAsPayload?: boolean
viewMode?: boolean