# new ListComponent()
This component provides a flexible way to display lists of data with support for infinite scrolling, pagination, searching, and custom item rendering. It can fetch data from various sources including models, functions, or direct data input.
The component supports two main display types:
- Infinite scrolling - Loads more data as the user scrolls
- Pagination - Displays data in pages with navigation controls
Additional features include:
- Pull-to-refresh functionality
- Search filtering
- Empty state customization
- Custom item rendering
- Event emission for interactions
A versatile list component that supports various data display modes.
- Implements:
- OnInit
Example
<ngx-decaf-list
[source]="dataSource"
[limit]="10"
[type]="'infinite'"
[showSearchbar]="true"
(clickEvent)="handleItemClick($event)"
(refreshEvent)="handleRefresh($event)">
</ngx-decaf-list>
Extends
- NgxBaseComponentDirective
Methods
# async destroy() → {Promise.<void>}
Invoked by Angular teardown logic to ensure the base directive and any attached repositories stop emitting events, preventing memory leaks when the list component leaves the DOM.
The method performs the following actions:
- Delegates to the parent directive's
ngOnDestroyfor shared cleanup - Detaches the repository observer when one is registered
- Catches and logs repository errors to avoid bubbling failures
- Clears internal references to large objects so they can be garbage collected
Releases component resources and unregisters repository observers.
Resolves when every teardown step completes.
Promise.<void>
# async protected getMapper() → {KeyValue}
Merges the component mapper with the primary key metadata and filters non-string entries so downstream rendering logic only receives valid bindings.
Produces the sanitized mapper configuration.
A mapper object that contains string values mapped to the component's public keys.
KeyValue
# async handleCreate(uid) → {Promise.<void>}
Handles the create event from the repository.
Handles the create event from the repository.
Parameters:
| Name | Type | Description |
|---|---|---|
uid |
string
|
number
|
The ID of the item to create. |
A promise that resolves when the item is created and added to the list.
Promise.<void>