GridStack Angular Library - v12.3.3
    Preparing search index...

    Angular component wrapper for GridStack.

    This component provides Angular integration for GridStack grids, handling:

    • Grid initialization and lifecycle
    • Dynamic component creation and management
    • Event binding and emission
    • Integration with Angular change detection

    Use in combination with GridstackItemComponent for individual grid items.

    <gridstack [options]="gridOptions" (change)="onGridChange($event)">
    <div empty-content>Drag widgets here</div>
    </gridstack>

    Implements

    • OnInit
    • AfterContentInit
    • OnDestroy
    Index

    Accessors

    • get grid(): undefined | GridStack

      Get the underlying GridStack instance. Use this to access GridStack API methods directly.

      Returns undefined | GridStack

      this.gridComponent.grid.addWidget({x: 0, y: 0, w: 2, h: 1});
      

    Constructors

    Methods

    • Register a list of Angular components for dynamic creation.

      Parameters

      • typeList: Type<Object>[]

        Array of component types to register

      Returns void

      GridstackComponent.addComponentToSelectorType([
      MyWidgetComponent,
      AnotherWidgetComponent
      ]);
    • Extract the selector string from an Angular component type.

      Parameters

      • type: Type<Object>

        The component type to get selector from

      Returns string

      The component's selector string

    • A callback method that is invoked immediately after the default change detector has checked the directive's data-bound properties for the first time, and before any of the view or content children have been checked. It is invoked only once when the directive is instantiated.

      Returns void

    • called when the TEMPLATE (not recommended) list of items changes - get a list of nodes and update the layout accordingly (which will take care of adding/removing items changed by Angular)

      Returns void

    Properties

    gridstackItems?: QueryList<GridstackItemComponent>

    List of template-based grid items (not recommended approach). Used to sync between DOM and GridStack internals when items are defined in templates. Prefer dynamic component creation instead.

    container?: ViewContainerRef

    Container for dynamic component creation (recommended approach). Used to append grid items programmatically at runtime.

    isEmpty?: boolean

    Controls whether empty content should be displayed. Set to true to show ng-content with 'empty-content' selector when grid has no items.

    <gridstack [isEmpty]="gridItems.length === 0">
    <div empty-content>Drag widgets here to get started</div>
    </gridstack>
    addedCB: EventEmitter<nodesCB> = ...

    Emitted when widgets are added to the grid

    changeCB: EventEmitter<nodesCB> = ...

    Emitted when grid layout changes

    disableCB: EventEmitter<eventCB> = ...

    Emitted when grid is disabled

    dragCB: EventEmitter<elementCB> = ...

    Emitted during widget drag operations

    dragStartCB: EventEmitter<elementCB> = ...

    Emitted when widget drag starts

    dragStopCB: EventEmitter<elementCB> = ...

    Emitted when widget drag stops

    droppedCB: EventEmitter<droppedCB> = ...

    Emitted when widget is dropped

    enableCB: EventEmitter<eventCB> = ...

    Emitted when grid is enabled

    removedCB: EventEmitter<nodesCB> = ...

    Emitted when widgets are removed from the grid

    resizeCB: EventEmitter<elementCB> = ...

    Emitted during widget resize operations

    resizeStartCB: EventEmitter<elementCB> = ...

    Emitted when widget resize starts

    resizeStopCB: EventEmitter<elementCB> = ...

    Emitted when widget resize stops

    ref: undefined | ComponentRef<GridstackComponent>

    Component reference for dynamic component removal. Used internally when this component is created dynamically.

    selectorToType: SelectorToType = {}

    Mapping of component selectors to their types for dynamic creation.

    This enables dynamic component instantiation from string selectors. Angular doesn't provide public access to this mapping, so we maintain our own.

    GridstackComponent.addComponentToSelectorType([MyWidgetComponent]);
    
    _options?: GridStackOptions
    _grid?: GridStack
    _sub: undefined | Subscription
    loaded?: boolean
    elementRef: ElementRef<GridCompHTMLElement>