Skip to content

Commit c1390b8

Browse files
committed
Add events item-added-to-dom and item-displayed #11703
1 parent 9cf3af8 commit c1390b8

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

projects/angular-natural-gallery/src/lib/natural-gallery/natural-gallery.component.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export class NaturalGalleryComponent<T extends ModelAttributes = ModelAttributes
1515
// eslint-disable-next-line @angular-eslint/no-output-native
1616
public readonly select = output<CustomEventDetailMap<T>['select']>();
1717
public readonly pagination = output<CustomEventDetailMap<T>['pagination']>();
18+
public readonly itemAddedToDom = output<CustomEventDetailMap<T>['item-added-to-dom']>();
19+
public readonly itemDisplayed = output<CustomEventDetailMap<T>['item-displayed']>();
1820

1921
private readonly galleryElement = viewChild.required<ElementRef<HTMLElement>>('gallery');
2022

@@ -52,6 +54,14 @@ export class NaturalGalleryComponent<T extends ModelAttributes = ModelAttributes
5254
this.pagination.emit(ev.detail);
5355
});
5456

57+
gallery.addEventListener('item-added-to-dom', ev => {
58+
this.itemAddedToDom.emit(ev.detail);
59+
});
60+
61+
gallery.addEventListener('item-displayed', ev => {
62+
this.itemDisplayed.emit(ev.detail);
63+
});
64+
5565
if (this._items.length) {
5666
gallery.setItems(this._items);
5767
}

src/app/app.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
(pagination)="log('pagination', $event)"
1111
(activate)="log('activate', $event)"
1212
(select)="log('select', $event)"
13+
(itemAddedToDom)="log('item-added-to-dom', $event)"
1314
/>

0 commit comments

Comments
 (0)