Function
hasFormValue
@ng-forge/dynamic-forms
Type guard to check if a form event has a form value attached.
Use this to safely access the formValue property on events when
is enabled globally or withEventFormValue()options.emitFormValueOnEvents
is set to true in the form config.
Signature
function hasFormValue<
T extends FormEvent
>(event: T): booleanType Parameters
| Name | Constraint | Default | Description |
|---|---|---|---|
T | FormEvent | - | - |
Parameters
| Name | Type | Description |
|---|---|---|
event | T | - The form event to check |
Returns
boolean
Examples
eventBus.on<SubmitEvent>('submit').subscribe(event => {
if (hasFormValue(event)) {
console.log('Form value:', event.formValue);
}
});packages/dynamic-forms/src/lib/events/interfaces/form-event.ts:53