ionic-img-viewer
ionic-img-viewer copied to clipboard
adding imageViewer to the img tag does not work
Please provide you version information :
| Dependency | Version |
|---|---|
| ionic2 | 3.18.0 |
| angular | 5.2.9 |
| ionic-img-viewer | 2.9.0 |
I was able to get it working with creating my own instance of imageViewer
<img src="assets/imgs/bilirubin.png" #myImage (click)="zoomImage(myImage)" />
zoomImage(myImage) {
const imageViewer = this._imageViewerCtrl.create(myImage);
imageViewer.present();
console.log(myImage);
setTimeout(() => imageViewer.dismiss(), 5000);
}
But as my app works, I have to get it working with just adding the imageViewer to img tag which does not work. Can you help out with why the below method does not work
<img src="assets/imgs/bilirubin.png" imageViewer />
+1
Hey, Do you have any error in the console ?
Add the IonicImageViewerModule to your page' smodule.ts like this
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { DemoPhotoShootPage } from './demo-photo-shoot';
import { TranslateModule } from '@ngx-translate/core';
import { IonicImageViewerModule } from 'ionic-img-viewer';
@NgModule({
declarations: [
DemoPhotoShootPage,
],
imports: [
IonicPageModule.forChild(DemoPhotoShootPage),
TranslateModule.forChild(),
IonicImageViewerModule,
],
})
export class DemoPhotoShootPageModule {}
After this it works fine :)