Skip to content

Commit

Permalink
Stop event propagation on imageViewerelements
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Riron committed Mar 31, 2017
1 parent 397a00e commit 151ebf0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/image-viewer.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export class ImageViewerDirective {
private _el: ElementRef
) { }

@HostListener('click') onClick(): void {
@HostListener('click', ['$event']) onClick(event: Event): void {
event.stopPropagation();

let position = this._el.nativeElement.getBoundingClientRect();

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

0 comments on commit 151ebf0

Please sign in to comment.