Class
AppendArrayItemEvent
@ng-forge/dynamic-forms
Event dispatched to append a new item at the END of an array field.
This is the most common array operation - adding items to the end. For other positions, use {@link PrependArrayItemEvent} or {@link InsertArrayItemEvent}.
Signature
class AppendArrayItemEvent<
TTemplate extends ArrayItemDefinitionTemplate = ArrayItemDefinitionTemplate
>
implements FormEventType Parameters
| Name | Constraint | Default | Description |
|---|---|---|---|
TTemplate | ArrayItemDefinitionTemplate | ArrayItemDefinitionTemplate | The type of the template (single field or array of fields) |
Properties
| Name | Type | Description |
|---|---|---|
type | "append-array-item" | - |
Examples
// Object item: append { name, email } object
eventBus.dispatch(arrayEvent('contacts').append([
{ key: 'name', type: 'input', label: 'Name' },
{ key: 'email', type: 'input', label: 'Email' }
]));
// Primitive item: append single value
eventBus.dispatch(arrayEvent('tags').append(
{ key: 'tag', type: 'input', label: 'Tag' }
));packages/dynamic-forms/src/lib/events/constants/append-array-item.event.ts:36