Riron / ionic-img-viewer

Ionic 2+ component providing a Twitter inspired experience to visualize pictures.
MIT License
283 stars 119 forks source link

lazy loading #74

Open 7martinelli opened 7 years ago

7martinelli commented 7 years ago

Please provide you version information :

Dependency Version
ionic2 3.4.2
angular 4
ionic-img-viewer

Have you checked...

Lazy loading is not compatible with the plugin.

Riron commented 7 years ago

What do you mean by lazy loading ? Please provide some more details !

chukwu commented 7 years ago

I think what he means is for pages lazy loaded with its ngModules, your directive or component breaks. As of today, with Ionic 3.5.3 it fails to support ionic-angular@3.5.2 for all loading methods.

try installing it on latest ionic project you will find an error stating:

UNMET PEER DEPENDENCY ionic-angular@3.5.2 └── ionic-img-viewer@2.4.0

I think you need to update it. Its not working for my project.

Great stuff though.

netsesame2 commented 7 years ago

Lazy loading is a new feature introduced in ionic 3 and angular 4. By this, pages can be loaded only when first jump to.

Every page needs to be lazy loading, add a module wrapper to this page. So, to use this component with lazy loading, both import the IonicImageViewerModule into AppModule and the PageModule you used, it will works.

chukwu commented 7 years ago

Tried that!!! Doesn't work!!!! Added IonicImageViewerModule to both AppModule and PageModule. No errors, no result, no console log.

Reinstalled it!!! Nothing!!!

Have you tested it recently?

netsesame2 commented 7 years ago

I just did it last night. Maybe you missed something somewhere.

  1. Add IonicImageViewerModule to AppModule, in app.module.ts
    import { IonicImageViewerModule } from 'ionic-img-viewer';
    ...
    @NgModule {
    ...
    imports: [
    IonicImageViewerModule, ...
    ]
    }
  2. Add IonicImageViewerModule to YourPageModule, such as photo-slide.module.ts:
    
    import { IonicImageViewerModule } from 'ionic-img-viewer';

@NgModule({ ... imports: [ IonicImageViewerModule, IonicPageModule.forChild(PhotoSlidePage) ] })


3. Add imaegViewer attribute to img tag in template file of photo-slide.ts

<img [src]="photo.path" class="photo" imageViewer />



4. Enjoy it.
satveshk commented 7 years ago

It should work for Base64 image string right? I am using the ImageViewerController but nothing shows up after clicking on the image. Using Ionic 3.5.0

bisak commented 7 years ago

@netsesame2 Also had to do that to get it working. Should have worked it with just adding it to the main app module but who knows...

tylkomat commented 7 years ago

@biskazz @Riron Same with me. I had expected it to word when only adding it to the page module. Which was sufficient for any other module that I use.

kevingrabher commented 6 years ago

@satveshk works for me. Can you post your code? Have you tried with a jpg, does it work then, but not with Base64?