Type

AsyncCondition

@ng-forge/dynamic-forms

Condition that resolves asynchronously via a custom function.

Two mutually exclusive forms: - asyncFunctionName: name of a function registered in customFnConfig.asyncConditions. JSON-serializable; suitable for configs loaded from APIs, databases, or OpenAPI. - asyncFn: inline async function. NOT JSON-serializable; for code-only configs.

Exactly one of asyncFunctionName or asyncFn must be set.

The function is resolved reactively — when dependent form values change, the function is re-evaluated (with debouncing). The result is cached per evaluation to avoid redundant calls.

Since LogicFn must return boolean synchronously, this condition uses a signal-based async resolution pattern internally.

@public

Signature

type AsyncCondition =
  | (AsyncConditionBase & {
      /** Name of the registered async condition function */
      asyncFunctionName: string;
      /** Inline form is forbidden when `asyncFunctionName` is set */
      asyncFn?: never;
    })
  | (AsyncConditionBase & {
      /**
       * Inline async condition function. Mutually exclusive with `asyncFunctionName`.
       *
       * NOT JSON-serializable — for code-only configs. For configs loaded
       * from JSON / OpenAPI / databases, use `asyncFunctionName` to reference
       * a function registered in `customFnConfig.asyncConditions`.
       */
      asyncFn: AsyncConditionFunction;
      /** Registered form is forbidden when `asyncFn` is set */
      asyncFunctionName?: never;
    });