Item Action Template
Overview
The ngxItemActionTemplate directive is a type-safe helper for Angular templates.
It does not add any runtime logic — instead, it allows Angular's type system to correctly infer the $implicit variable type inside an ng-template that represents an item action.
This improves developer experience by enabling autocompletion and type checking when working with item actions.
Import
import { DndModule } from 'ngx-builder-dnd';Selector
ngxItemActionTemplate
API Reference
Type Parameters
| Name | Description |
|---|---|
TActionId extends string = DefaultItemActionType | Defines the type of the action identifier. Defaults to DefaultItemActionType. |
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
ngxItemActionTemplate | ItemAction<TActionId> | - | The list of item actions made available to the template. |
Template Context
Within the ng-template, Angular will infer the following context type:
interface ItemActionTemplateContext<TActionId extends string> {
$implicit: ItemAction<TActionId>;
}
Example
<div
[ngxDragDropZone]="item"
[allowedItems]="allowedItems"
ngxHoverIndicator
ngxDropIndicator
ngxActionMenu
[actionButtons]="actions"
[settingsButtonTemplate]="actionButton"
(actionTriggered)="onAction($event)">
<div>item</div>
</div>
<ng-template
#actionButton
ngxBuilderBlockActionTemplate
[ngxBuilderBlockActionTemplate]="actions"
let-action
>
<button>{{ action.label }}</button>
</ng-template>
See Also
- Abstract Item Actions Directive - Provides base functionality for item actions.
- Action Menu Directive - Attaches an action menu to an item.
- Item Actions Component - Displays contextual item actions such as edit, clone, or delete.
- Item Action Model - Represents configuration and metadata for item actions.