dynamic-forms / Class

AppendArrayItemEvent

Generic types:TTemplate
Implements:FormEvent

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}.

Constructor

No documentation has been provided.

Presentation
constructor(
	readonly arrayKey: string, 
	readonly template: TTemplate
): AppendArrayItemEvent<TTemplate>;
Parameters
NameTypeDescription
r
arrayKey
string
r
template
TTemplate

Properties

NameTypeDescription
type
r
implements FormEvent
"append-array-item"

Example usage

// 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' }
));