Tom CLERC
Tom CLERC

Reputation: 29

Ionic Photoviewer - how to use?

I am a beginner in Ionic 2 and I would like to know how you use Photoviewer functionnality from Ionic framework. (available here : official website)

It said :

Usage

import { PhotoViewer } from '@ionic-native/photo-viewer';

constructor(private photoViewer: PhotoViewer) { }

...

this.photoViewer.show('https://example.com/path/to/image.jpg');

this.photoViewer.show('https://example.com/path/to/image.jpg', 'My image title', {share: false});

But where do I need to put it ? in a function ? how the function will be called ?

Thank's for all.

Upvotes: 1

Views: 5984

Answers (1)

Anil Sharma
Anil Sharma

Reputation: 615

You can create a function like

zoomImage(imageData) {
      this.photoViewer.show(imageData);
  }

and call this function on your image click.

 <img src="/path/to/image.jpg" (click)="zoomImage('/path/to/image.jpg')"/>

Upvotes: 1

Related Questions