Type
AsyncConditionFunction
@ng-forge/dynamic-forms
Async function for conditions — returns boolean.
The function receives the evaluation context and may return a Promise or Observable.
Register functions in customFnConfig.asyncConditions.
Signature
type AsyncConditionFunction<TFormValue extends Record<string, unknown> = any> = (
context: EvaluationContext<unknown, TFormValue>,
) => Promise<boolean> | Observable<boolean>;Type Parameters
| Name | Constraint | Default | Description |
|---|---|---|---|
TFormValue | Record<string, unknown> | any | - |
Examples
const checkPermission: AsyncConditionFunction = async (context) => {
const response = await fetch(`/api/permissions?user=${context.formValue.userId}`);
const data = await response.json();
return data.canEdit;
};packages/dynamic-forms/src/lib/core/expressions/async-custom-function-types.ts:44