v8

Configs

Provider config

import { ApplicationConfig } from '@angular/core';
import { provideNgDynamicJsonForm } from 'ng-dynamic-json-form';

export const appConfig: ApplicationConfig = {
  ...
  providers: [
    provideNgDynamicJsonForm({
      customValidators: {...},
      uiComponents: {...},
      labelComponent: ...,
      loadingComponent: ...,
      errorComponent: ...,
      hideErrorsFor: [...],
    }),
  ]
}

Properties

customValidators

See Provide custom validators globally

uiComponents

See UI components

labelComponent

See Overwrite all the labels

loadingComponent

See Overwrite all the loadings

errorComponent

See Overwrite all the errors

hideErrorsForTypes

Hide the error message section of the control where its type is included in the list.

provideNgDynamicJsonForm({
  ...
  hideErrorsForTypes: ["text", "checkbox", "customTypeToHide"],
}),

showErrorsOnTouched

Show errors when the control is touched. Default is true.

FormControlConfig

The configuration to generate form.

export interface FormControlConfig {
  formControlName: string;
  conditions?: Conditions;
  children?: FormControlConfig[];
  description?: string;
  props?: any;
  hidden?: boolean;
  label?: string;
  layout?: FormLayout;
  inputMask?: FactoryArg;
  options?: FormControlOptions;
  readonly?: boolean;
  type?: FormControlType;
  value?: any;
  validators?: ValidatorConfig[];
}

Properties

formControlName

The form control name of this control. Should be unique.

  • All the spaces will be replaced by _ automatically.
  • All the . and , characters will be removed automatically.

conditions

See Conditions.

children

An array of FormControlConfig, use this to create FormGroup for this control.

description

Description for this input.

props

Use to bind properties and attributes to the target component or the input element.

hidden

Don't render this input in the DOM.

label

The label of this input.

layout

See Layout.

inputMask

See Input Mask.

options

See Options.

readonly

A readonly class will be added to the host element. Can use to disable user to interact with this input.

type

See Input Types.

value

Default value of this control.

validators

See Validators.