provideAddonActions
@ng-forge/dynamic-forms
Register named action handlers reachable via JSON-driven addon configs.
Once registered, a backend can ship
{ kind: 'prime-button', actionRef: 'openProfile' } and the FE will invoke
the corresponding handler at click time.
Define handlers once and augment the registry from the same object:
export const appActions = provideAddonActions({ openProfile: (ctx) => modalService.open(ProfileModal, { data: ctx.value }), runWorkflow: (ctx) => workflowService.run(ctx.field.key, ctx.value), });declare module '@ng-forge/dynamic-forms' { // Pulls the keys straight off
appActions— no manual list to keep in sync. interface DynamicFormActionRegistry extends Record<NonNullable<typeof appActions['__handlerKeys']>, true> {} }
// Then in your bootstrap: provideDynamicForm(...withPrimeNGFields(), appActions);
Multiple provideAddonActions(...) calls are merged; later names override
earlier ones for the same key.
Signature
function provideAddonActions<
const H extends Record<string, AddonActionHandler>
>(handlers: H): AddonActionsFeature<keyof H & string>Type Parameters
| Name | Constraint | Default | Description |
|---|---|---|---|
H | Record<string, AddonActionHandler> | - | - |
Parameters
| Name | Type | Description |
|---|---|---|
handlers | H | - |
Returns
AddonActionsFeature<keyof H & string>
packages/dynamic-forms/src/lib/providers/features/addons/provide-addon-actions.ts:45