Skip to content

Commit 151ebf0

Browse files
committed
Stop event propagation on imageViewerelements
A click on an `imageViewer` should not propagate : if you use an image in a list item, you don't want the click to propagate to the item Closes #40
1 parent 397a00e commit 151ebf0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/image-viewer.directive.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ export class ImageViewerDirective {
1515
private _el: ElementRef
1616
) { }
1717

18-
@HostListener('click') onClick(): void {
18+
@HostListener('click', ['$event']) onClick(event: Event): void {
19+
event.stopPropagation();
20+
1921
let position = this._el.nativeElement.getBoundingClientRect();
2022

2123
let imageViewer = ImageViewer.create({image: this.src || this._el.nativeElement.src, position: position});

0 commit comments

Comments
 (0)