Function

withEventFormValue

@ng-forge/dynamic-forms

Enables automatic form value attachment to all events dispatched through the EventBus.

When this feature is enabled, events dispatched via eventBus.dispatch() will include the current form value in the formValue property. This is useful for event handlers that need access to the complete form state at the time of the event.

Remarks

Precedence rules: 1. Per-form false - Disables for this form, regardless of global setting 2. Per-form true - Enables for this form, regardless of global setting 3. Per-form undefined - Uses global setting 4. Global withEventFormValue() - Enables globally 5. No global feature - Disabled globally (default)

Signature

function withEventFormValue(): DynamicFormFeature<"event-form-value">

Returns

DynamicFormFeature<"event-form-value">

Examples

provideDynamicForm(
...withMaterialFields(),
withEventFormValue()
)
eventBus.on<SubmitEvent>('submit').subscribe(event => {
if (hasFormValue(event)) {
console.log('Form value:', event.formValue);
}
});
const config: FormConfig = {
fields: [...],
options: { emitFormValueOnEvents: false }
};