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. will include
the current form value in the dispatch()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 - Enables globally
5. No global feature - Disabled globally (default)withEventFormValue()
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 }
};packages/dynamic-forms/src/lib/providers/features/event-form-value/with-event-form-value.ts:48