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 FormEvent

Type Parameters

NameConstraintDefaultDescription
TTemplateArrayItemDefinitionTemplateArrayItemDefinitionTemplateThe type of the template (single field or array of fields)

Properties

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