Search code examples
angularionic3ionic-native

i used ionic-img-viewer for viewing image but it raised Cannot find module "rxjs/operators" error


i tried to use Programmatic ionic-img-viewer throw error:Uncaught Error: Cannot find module "rxjs/operators" My app.module.ts:

 import { IonicImageViewerModule } from 'ionic-img-viewer';
     ...
   imports: [
        BrowserModule,
        AllTrainSortPipe,
        DepartureSortPipe,
        IonicModule.forRoot(MyApp),
        HttpModule,
        IonicImageViewerModule
    ]

home.ts:

        import { ImageViewerController } from 'ionic-img-viewer';
        ...

    export class StationPage{
    private _imageViewerCtrl: ImageViewerController;

         constructor(imageViewerCtrl: ImageViewerController)
        {
         this._imageViewerCtrl = imageViewerCtrl; 
         }

          presentImage(myImage) {
                const imageViewer = this._imageViewerCtrl.create(myImage);
                imageViewer.present();
            }
    }

Solution

  • Apparently ionic-img-viewer was updated to use lettable operators of rxjs 5.5.0 in version 2.9.0.

    Your option is to update rxjs version to the current 5.5.2.

    npm i rxjs@5.5.2 --save
    

    This may include updating your code to use lettable operators or install an older version of ionic-img-viewer.

    npm i ionic-img-viewer@2.8.0 --save