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