Riron / ionic-img-viewer

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

[Feature] Add support for dynamic images #42

Closed gatapia closed 7 years ago

gatapia commented 7 years ago

I am loading html content from the server and displaying it in an ionic app. It would be great to be able to use this plugin to add imageViewer support for these dynamically loaded img tags. I tried to manually add click handlers to these images and using ImageViewer.create (copying code from your directive) but it appears that your module is not exporting the ImageViewer class.

Not totally familiar with the internals of modules in ng2 so not sure whether adding this to the exports would do the trick. Anyways, would be nice to have, in the meantime I'm hacking something together.

Update: can confirm that if I add ImageViewer to the generated exports from your module then dynamic images are supported.

Riron commented 7 years ago

You mean you would like to have a programmatic way to launch the viewer ? Like in an onClick handler instead of with the directive ? Sounds like a good idea ! I'll try to give it a look, but feel free to make a PR if you wish 👍

fourcube commented 7 years ago

I've just created a pull request for this because I needed to instantiate the ImageViewer through a dynamic component instead of a directive (using ng-dynamic). @Riron thank you for this amazing module.

fourcube commented 7 years ago

Since #58 has been merged, I think this issue can be closed as soon as 2.4.0 is published.

victor-carv commented 7 years ago

So, using master is possible to use click handlers and instantiate the ImageViewer? If yes, could you please provide some example?

I'm facing the same issue, this would be a great help.

Riron commented 7 years ago

Yeah it's technically possible with ng-dynamic but not intuitive and adds more dependencies. If you wait just a few more days, an "official way" of doing it will land in the next release 😉

victor-carv commented 7 years ago

ok @Riron I'll wait. Thank you a lot for this module

Riron commented 7 years ago

Closing this issue as it landed in ionic-img-viewer@2.4.0.