Type

AddonActionContext

@ng-forge/dynamic-forms

Context handed to inline addon actions and registered handler functions.

Discriminated by form: field-bound contexts have a non-null form and a required setValue; orphan contexts have form: null and no setValue. Use {@link isFieldBoundContext} when the handler needs to write back.

Signature

type AddonActionContext<TValue = unknown> = FieldBoundAddonActionContext<TValue> | OrphanAddonActionContext<TValue>;

Type Parameters

NameConstraintDefaultDescription
TValue-unknown-

Examples

provideAddonActions({
  submit: (ctx) => {
    if (!isFieldBoundContext(ctx)) return;
    // ctx.setValue is now `(next: TValue) => void` — no optional chain.
    myService.send(ctx.field.key, ctx.value, ctx.setValue);
  },
});