import { App } from 'ionic-angular';
import { ElementRef, HostListener, Directive, Input } from '@angular/core';

import { ImageViewer } from './image-viewer';

@Directive({
	selector: '[imageViewer]'
})
export class ImageViewerDirective {

	@Input('imageViewer') src: string;

	constructor(
		private _app: App,
		private _el: ElementRef
	) { }

	@HostListener('click') onClick(): void {
		let position = this._el.nativeElement.getBoundingClientRect();

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

import { App } from 'ionic-angular';
import { ElementRef, HostListener, Directive, Input } from '@angular/core';

import { ImageViewer } from './image-viewer';

@Directive({
	selector: '[imageViewer]'
})
export class ImageViewerDirective {

	@Input('imageViewer') src: string;

	constructor(
		private _app: App,
		private _el: ElementRef
	) { }

	@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});
		this._app.present(imageViewer, {});
	}
}

Stop event propagation on `imageViewer`elements
Stop event propagation on `imageViewer`elements

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
